fix error handling (errors were returning 500)

This commit is contained in:
bretello 2024-06-15 18:26:45 +02:00
parent 7a3d365928
commit 0dcdabe339
Signed by: brethil
GPG Key ID: 876AAC6290170FE7

7
app.py
View File

@ -33,10 +33,9 @@ def post_index():
try:
ldap_change_password(form('username'),
form('old-password'), form('new-password'))
except Error as e:
print("Unsuccessful attemp to change password for {}: {}"
.format(form('username'), str(e)))
return error(str(e))
except Exception as exc:
print(f"Unsuccessful attempt to change password for {form('username')}: {exc=}")
return error(str(exc))
print("Password successfully changed for: {}"
.format(form('username')))