Browse Source

fix register

ming 3 years ago
parent
commit
af85c9abb2
1 changed files with 4 additions and 6 deletions
  1. 4 6
      api/main.py

+ 4 - 6
api/main.py

@@ -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']})