Merge pull request #1171 from modoboa/fix/password_update

Fixed profile update view.
This commit is contained in:
Antoine Nguyen
2017-07-05 18:57:05 +02:00
committed by GitHub
2 changed files with 12 additions and 0 deletions
+2
View File
@@ -80,6 +80,8 @@ class ProfileForm(forms.ModelForm):
def clean_confirmation(self):
newpassword = self.cleaned_data["newpassword"]
confirmation = self.cleaned_data["confirmation"]
if not newpassword and not confirmation:
return confirmation
if newpassword != confirmation:
raise forms.ValidationError(_("Passwords mismatch"))
password_validation.validate_password(confirmation, self.instance)
+10
View File
@@ -84,6 +84,16 @@ class ProfileTestCase(ModoTestCase):
username="user@test.com", groups=('SimpleUsers',)
)
def test_update_profile(self):
"""Update profile without password."""
data = {
"first_name": "Homer", "last_name": "Simpson",
"phone_number": "123445", "language": "en"
}
self.ajax_post(reverse("core:user_profile"), data)
admin = models.User.objects.get(username="admin")
self.assertEqual(admin.last_name, "Simpson")
def test_update_password(self):
"""Password update