Fix the redundant error message during user create

Simply check if both password and confirm_password fields are not empty.

Change-Id: Ie04e0515f15993ed3f693d107475939604e55310
Closes-Bug: #1445043
This commit is contained in:
Dimitri Mazmanov 2015-04-16 19:00:47 +02:00
parent 4dcb0c0cd4
commit 21d155395c

View File

@ -51,8 +51,8 @@ class PasswordMixin(forms.SelfHandlingForm):
def clean(self):
'''Check to make sure password fields match.'''
data = super(forms.Form, self).clean()
if 'password' in data:
if data['password'] != data.get('confirm_password', None):
if 'password' in data and 'confirm_password' in data:
if data['password'] != data['confirm_password']:
raise ValidationError(_('Passwords do not match.'))
return data