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: try:
ldap_change_password(form('username'), ldap_change_password(form('username'),
form('old-password'), form('new-password')) form('old-password'), form('new-password'))
except Error as e: except Exception as exc:
print("Unsuccessful attemp to change password for {}: {}" print(f"Unsuccessful attempt to change password for {form('username')}: {exc=}")
.format(form('username'), str(e))) return error(str(exc))
return error(str(e))
print("Password successfully changed for: {}" print("Password successfully changed for: {}"
.format(form('username'))) .format(form('username')))