user name case sensitivity

This commit is contained in:
Jörn-Michael Miehe 2023-11-21 22:54:37 +01:00
parent 489d64414e
commit a86e47113c
2 changed files with 9 additions and 3 deletions

View file

@ -1,6 +1,5 @@
# MUSS
- api: admin Login case sensitivity (username "admin" == "AdMiN")
- api: Config-Liste von Extra-Türchen (kein Buchstabe, nur manuelles Bild)
- api: Config-Option "Überspringe leere Türchen" (standard ja)
@ -20,3 +19,4 @@
- Option "Leerzeichen ignorieren" (standard ja)
- Nach einigen Sekunden: Meldung "Türchen anzeigen?"
- `alert` durch bulma Komponente(n) ersetzen
- api: admin Login case sensitivity (username "admin" == "AdMiN")

View file

@ -19,8 +19,14 @@ async def user_is_admin(
True iff der user "admin" ist
"""
username_correct = secrets.compare_digest(credentials.username, cfg.admin.name)
password_correct = secrets.compare_digest(credentials.password, cfg.admin.password)
username_correct = secrets.compare_digest(
credentials.username.lower(),
cfg.admin.name.lower(),
)
password_correct = secrets.compare_digest(
credentials.password,
cfg.admin.password,
)
return username_correct and password_correct