fix signup
This commit is contained in:
@@ -28,7 +28,7 @@ class DB:
|
||||
|
||||
if in_transaction:
|
||||
conn.commit()
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
if in_transaction and self._connection:
|
||||
conn.rollback()
|
||||
finally:
|
||||
|
||||
@@ -67,11 +67,22 @@ def get_active_user():
|
||||
|
||||
|
||||
def create_session(user_id):
|
||||
return Sessions.create({
|
||||
"key": secrets.token_hex(16),
|
||||
print('key')
|
||||
key = secrets.token_hex(16)
|
||||
print(key)
|
||||
print('user id')
|
||||
print(user_id)
|
||||
print('expires')
|
||||
expires_at = int(time.time()) + 31 * 24 * 60 * 60
|
||||
print(expires_at)
|
||||
print('create')
|
||||
s = Sessions.create({
|
||||
"key": key,
|
||||
"user_id": user_id,
|
||||
"expires_at": int(time.time()) + 31 * 24 * 60 * 60,
|
||||
"expires_at": expires_at,
|
||||
})
|
||||
print(s)
|
||||
return s
|
||||
|
||||
|
||||
def extend_session(user_id):
|
||||
@@ -334,8 +345,9 @@ def sign_up_post():
|
||||
else:
|
||||
display_name = ''
|
||||
|
||||
with db.transaction():
|
||||
new_user = Users.create({
|
||||
"username": username,
|
||||
"username": username.lower(),
|
||||
'display_name': display_name,
|
||||
"password_hash": hashed,
|
||||
"permission": PermissionLevel.GUEST.value,
|
||||
|
||||
Reference in New Issue
Block a user