|
@@ -225,14 +225,12 @@ async def register_old(request: Request):
|
|
async def register(request: models.register_req):
|
|
async def register(request: models.register_req):
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
user_obj = first(db.query('SELECT * FROM users where username ="'+str(request.username)+'"'))
|
|
user_obj = first(db.query('SELECT * FROM users where username ="'+str(request.username)+'"'))
|
|
- then = datetime.now()
|
|
|
|
|
|
+
|
|
if user_obj == None:
|
|
if user_obj == None:
|
|
if user_register(request):
|
|
if user_register(request):
|
|
- while user_obj == None :
|
|
|
|
- user_obj = first(db.query('SELECT * FROM users where username ="'+str(request.username)+'"'))
|
|
|
|
- duration = datetime.now() - then
|
|
|
|
- if duration.total_seconds() > 10:
|
|
|
|
- break
|
|
|
|
|
|
+ print(request.username)
|
|
|
|
+ user_obj = first(db.query('SELECT * FROM users where username ="'+str(request.username)+'"'))
|
|
|
|
+
|
|
veri_table = db['register_veri_code']
|
|
veri_table = db['register_veri_code']
|
|
code = str(time.time()).replace('.','')
|
|
code = str(time.time()).replace('.','')
|
|
veri_table.insert({'code':code,'user_id':user_obj['id']})
|
|
veri_table.insert({'code':code,'user_id':user_obj['id']})
|