13 lines
437 B
Python
13 lines
437 B
Python
# 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
|