mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user