aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-04-22 21:35:02 +0200
committerlonkaars <l.leblansch@gmail.com>2021-04-22 21:35:02 +0200
commit1cf6504bbbaf946da792985a0bd7ada6ea85a281 (patch)
tree7821a5414486da322af9756b1405449849e4eecf
parentbde4d5721e9e3d2d1749ac7e012206828c072d07 (diff)
implement user secrets
-rw-r--r--api/auth/signup.py5
-rw-r--r--database/init_db.sql2
2 files changed, 4 insertions, 3 deletions
diff --git a/api/auth/signup.py b/api/auth/signup.py
index bf1208d..571adb4 100644
--- a/api/auth/signup.py
+++ b/api/auth/signup.py
@@ -5,6 +5,7 @@ import auth.token as token
import passwords
import time
import re
+import bcrypt
# checks if the usename is between 3 and 35 charachters
@@ -68,8 +69,8 @@ def index():
# write new user to database and commit
cursor.execute(
- "insert into users values (?, ?, ?, NULL, NULL, ?, ?, \"[]\", FALSE, \"user\", \"{}\", \"online\") ",
- (user_id, username, email, password_hash, registered)
+ "insert into users values (?, ?, ?, NULL, NULL, ?, ?, \"[]\", FALSE, \"user\", \"{}\", ?) ",
+ (user_id, username, email, password_hash, registered, bcrypt.gensalt())
)
connection.commit()
diff --git a/database/init_db.sql b/database/init_db.sql
index cd52e2e..0807b56 100644
--- a/database/init_db.sql
+++ b/database/init_db.sql
@@ -12,7 +12,7 @@ create table if not exists users (
verified_email boolean not null,
type text not null,
preferences text not null,
- presence text
+ secret text not null
);
create table if not exists games (