initial commit
This commit is contained in:
12
dashboard/utils/auth.py
Normal file
12
dashboard/utils/auth.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# dashboard/utils/auth.py
|
||||
import bcrypt
|
||||
|
||||
def hash_password(plain_text: str) -> str:
|
||||
return bcrypt.hashpw(plain_text.encode("utf-8"), bcrypt.gensalt()).decode("utf-8")
|
||||
|
||||
def check_password(plain_text: str, hashed: str) -> bool:
|
||||
return bcrypt.checkpw(plain_text.encode("utf-8"), hashed.encode("utf-8"))
|
||||
|
||||
def get_user_role(username: str) -> str:
|
||||
# Beispiel: aus der Datenbank auslesen (oder Hardcode während Dev-Phase)
|
||||
pass
|
||||
Reference in New Issue
Block a user