From 3d1d4bcd5d0a404892e2fe93a7ec83924342bb42 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 3 Aug 2026 12:17:04 +0200 Subject: [PATCH] update auth.py --- backend/auth.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/backend/auth.py b/backend/auth.py index 6b2d946..e05c010 100644 --- a/backend/auth.py +++ b/backend/auth.py @@ -1,2 +1,19 @@ from database import execute -import bcrypt \ No newline at end of file +import bcrypt + +def create_user(username, password): + + password_hash = bcrypt.hashpw( + password.encode(), + bcrypt.gensalt() + ).decode() + + user_id = execute( + """ + INSERT INTO users (username, password_hash) + VALUES (?, ?) + """, + (username, password_hash) + ) + + return user_id \ No newline at end of file