Skip to content

Commit 1731e48

Browse files
committed
catch errors
1 parent 556b9a2 commit 1731e48

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

selfservice/blueprints/change.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Flask blueprint for handling all password changes for users who know their
33
current password.
44
"""
5-
5+
import python_freeipa.exceptions
66
from flask import Blueprint, render_template, request, redirect, flash
77
from selfservice.utilities.reset import passwd_change, PasswordChangeFailed
88
from selfservice import version
@@ -28,10 +28,10 @@ def change():
2828
try:
2929
passwd_change(username, old_pw, new_pw)
3030
return render_template("success.html", reset=True, version=version)
31-
except PasswordChangeFailed:
31+
except python_freeipa.exceptions.PWChangeInvalidPassword:
3232
flash("Incorrect password, please try again.")
33-
else:
34-
flash("Your password does not meet the requirements below.")
33+
except python_freeipa.exceptions.PWChangePolicyError:
34+
flash("Your password does not meet the requirements below.")
3535
else:
3636
flash("Whoops, those passwords didn't match!")
3737

0 commit comments

Comments
 (0)