changing to same password as previous is already prevented by HistoryPasswordValidator

(would have to move this to UserPasswordChangeForm but decided to remove instead as it's redundant)
This commit is contained in:
Mira Weller
2025-11-04 14:36:19 +01:00
parent 58d36706b2
commit b5cac90475

View File

@@ -78,21 +78,6 @@ class UserSettingsForm(forms.ModelForm):
'link': reverse('control:user.settings.email.change')
})
def clean(self):
password1 = self.cleaned_data.get('new_pw')
old_pw = self.cleaned_data.get('old_pw')
if password1 and password1 == old_pw:
raise forms.ValidationError(
self.error_messages['pw_equal'],
code='pw_equal'
)
if password1:
self.instance.set_password(password1)
return self.cleaned_data
class User2FADeviceAddForm(forms.Form):
name = forms.CharField(label=_('Device name'), max_length=64)