Files
calendar/backend/auth.py
T
2026-08-03 12:17:04 +02:00

19 lines
366 B
Python

from database import execute
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