mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Fixed security issue with password update.
This commit is contained in:
@@ -92,6 +92,11 @@ class ProfileForm(forms.ModelForm):
|
||||
confirmation, self.instance)
|
||||
else:
|
||||
self.add_error("oldpassword", _("This field is required."))
|
||||
elif newpassword or confirmation:
|
||||
if not confirmation:
|
||||
self.add_error("confirmation", _("This field is required."))
|
||||
else:
|
||||
self.add_error("newpassword", _("This field is required."))
|
||||
return self.cleaned_data
|
||||
|
||||
def save(self, commit=True):
|
||||
|
||||
@@ -146,6 +146,13 @@ class ProfileTestCase(ModoTestCase):
|
||||
self.client.login(username="user@test.com", password="toto"), True
|
||||
)
|
||||
|
||||
self.ajax_post(
|
||||
reverse("core:user_profile"),
|
||||
{"oldpassword": "toto",
|
||||
"confirmation": "tutu"},
|
||||
status=400
|
||||
)
|
||||
|
||||
self.ajax_post(
|
||||
reverse("core:user_profile"),
|
||||
{"oldpassword": "toto",
|
||||
|
||||
Reference in New Issue
Block a user