Passwortänderungsfunktionen fürs User hinzugefügt

This commit is contained in:
Alexander Malzkuhn 2025-06-04 06:25:45 +02:00
parent c6ab33857e
commit 66b71208c6

View File

@ -291,8 +291,22 @@ def homepage():
new_pw_input = ui.input(password=True)
ui.label("Neues Passwort bestätigen:")
new_pw_confirm_input = ui.input(password=True)
ui.button("Speichern")
ui.button("Zurücksetzen")
def revert_pw_inputs():
old_pw_input.value = ""
new_pw_input.value = ""
new_pw_confirm_input.value = ""
def save_new_password():
if hash_password(old_pw_input.value) == current_user.password:
if new_pw_input.value == new_pw_confirm_input.value:
current_user.password = hash_password(new_pw_input.value)
current_user.write_settings()
ui.notify("Neues Passwort gespeichert")
else:
ui.notify("Passwortbestätigung stimmt nicht überein")
else:
ui.notify("Altes Passwort nicht korrekt")
ui.button("Speichern", on_click=save_new_password)
ui.button("Zurücksetzen", on_click=revert_pw_inputs)
ui.space()
else: