diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-01-14 11:20:37 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-01-14 11:20:37 +0100 |
commit | 999cf5cd082419bfce0e5147468e14d58465faae (patch) | |
tree | 956af491d26f7e75e644cbf37c1243468c14ef19 /api/auth/signup.py | |
parent | ec27999881a452804da87a6190db7997ed21a9a2 (diff) |
semi token authentication
Diffstat (limited to 'api/auth/signup.py')
-rw-r--r-- | api/auth/signup.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/api/auth/signup.py b/api/auth/signup.py index da2dc7c..d82105a 100644 --- a/api/auth/signup.py +++ b/api/auth/signup.py @@ -1,6 +1,7 @@ from flask import Blueprint, request from main import cursor, connection from randid import new_uuid +import auth.token as token import passwords import time import json @@ -31,9 +32,11 @@ def index(): password_hash = passwords.password_hash(password, password_salt) registered = int( time.time() * 1000 ) - cursor.execute("insert into users values (?, ?, ?, NULL, ?, ?, ?, NULL, FALSE, \"user\", \"{}\", NULL, \"online\") ", + cursor.execute("insert into users values (?, ?, ?, NULL, ?, ?, ?, \"[]\", FALSE, \"user\", \"{}\", NULL, \"online\") ", (user_id, username, email, password_salt, password_hash, registered)) - connection.commit() - return "", 200 + new_token = token.generate_token() + token.add_token(user_id, token.hash_token(new_token)) + + return new_token, 200 |