feat: add database & auth manager classes
This commit is contained in:
12
server/auth.py
Normal file
12
server/auth.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from db.database import PostgresConnector
|
||||
|
||||
class AuthManager:
|
||||
def __init__(self, db: PostgresConnector, bcrypt):
|
||||
self.db = db
|
||||
self.bcrypt = bcrypt
|
||||
|
||||
def register_user(self, username, password):
|
||||
# Hash the password
|
||||
hashed_password = self.bcrypt.generate_password_hash(password).decode("utf-8")
|
||||
# Save the user to the database
|
||||
self.db.save_user(username, hashed_password)
|
||||
Reference in New Issue
Block a user