Make sure new password can not the same with old one
change password same with old one will give the error: Error: Unable to change password. This patch make sure new password can not the same with old one. Change-Id: Ib2261df262ba9bdf2b6d2ecb9cf5ce406893634d Closes-bug: #1641046
This commit is contained in:
parent
8c17f76e96
commit
316fedfb5b
@ -48,6 +48,10 @@ class PasswordForm(forms.SelfHandlingForm):
|
||||
if 'new_password' in data:
|
||||
if data['new_password'] != data.get('confirm_password', None):
|
||||
raise ValidationError(_('Passwords do not match.'))
|
||||
if data.get('confirm_password', None) == \
|
||||
data.get('current_password', None):
|
||||
raise ValidationError(_('Old password and new password '
|
||||
'must be different'))
|
||||
return data
|
||||
|
||||
# We have to protect the entire "data" dict because it contains the
|
||||
|
Loading…
Reference in New Issue
Block a user