Validate that the old_password field is correct.
(self)
| 535 | |
| 536 | @sensitive_variables("old_password") |
| 537 | def clean_old_password(self): |
| 538 | """ |
| 539 | Validate that the old_password field is correct. |
| 540 | """ |
| 541 | old_password = self.cleaned_data["old_password"] |
| 542 | if not self.user.check_password(old_password): |
| 543 | raise ValidationError( |
| 544 | self.error_messages["password_incorrect"], |
| 545 | code="password_incorrect", |
| 546 | ) |
| 547 | return old_password |
| 548 | |
| 549 | |
| 550 | class AdminPasswordChangeForm(SetUnusablePasswordMixin, SetPasswordMixin, forms.Form): |