#35477 closed Bug (fixed)
Required field error added to new_password1 on forms that inherit SetPasswordForm with additional new_password1 level validation.
Reported by: | אורי | Owned by: | Fabian Braun |
---|---|---|---|
Component: | contrib.auth | Version: | 5.1 |
Severity: | Release blocker | Keywords: | |
Cc: | Fabian Braun, Natalia Bidart | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hi,
I ran Speedy Net's tests with Django 5.1a1. Some tests failed with an unexpected error messages. These tests passed with Django versions 4.2.13 and 5.0.6.
To run these tests, run ./tests_manage_all_sites_with_all_warnings.sh test speedy.core.accounts.tests.test_views.EditProfileCredentialsViewEnglishTestCase --shuffle --test-all-languages
with Django==5.1a1
installed. Here are the error messages:
'new_password1': ['This password is too short. It must contain at least 8 characters.', 'This field is required.']
(the actual error message received)
'new_password1': ['This password is too short. It must contain at least 8 characters.']
(the expected error message)
It looks like the error message "This field is required."
is unexpected and doesn't appear with Django versions 4.2.13 and 5.0.6. Notice that this field was not missing but too short. A similar problem happens when the new password is too long.
I confirm the extra error message appears on the site with Django 5.1a1 and I created screenshots which I'm attaching here. The first screenshot I attached is with Django 5.1a1 and the second one with Django 4.2.13 (and is the expected error messages).
Attachments (2)
Change History (15)
by , 6 months ago
Attachment: | Untitled 2024-05-24 a1.png added |
---|
by , 6 months ago
Attachment: | Untitled 2024-05-24 a2.png added |
---|
comment:1 by , 6 months ago
Description: | modified (diff) |
---|
follow-up: 9 comment:2 by , 6 months ago
Component: | Uncategorized → contrib.auth |
---|---|
Severity: | Normal → Release blocker |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
comment:3 by , 6 months ago
Cc: | added |
---|---|
Summary: | Django 5.1a1 - unexpected error message → Required field error added to new_password1 on forms that inherit SetPasswordForm with additional new_password1 level validation. |
comment:5 by , 6 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 6 months ago
Has patch: | set |
---|
comment:7 by , 6 months ago
Needs tests: | set |
---|
comment:8 by , 6 months ago
Needs tests: | unset |
---|
comment:9 by , 6 months ago
Replying to Sarah Boyce:
Hi אורי, I spent quite a while with this. Next time please share links to your tests or code in the ticket.
Sorry about that. Code is under https://github.com/speedy-net/speedy-net. Tests are in relevant test files. Recent tests I ran are under https://github.com/speedy-net/speedy-net/actions.
The tests I mentioned in this ticket (speedy.core.accounts.tests.test_views.EditProfileCredentialsViewEnglishTestCase
) are under https://github.com/speedy-net/speedy-net/blob/main/speedy/core/accounts/tests/test_views.py. Notice that there are also tests for French, German and other languages.
comment:10 by , 6 months ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
comment:11 by , 6 months ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
Triage Stage: | Accepted → Ready for checkin |
Hi אורי, I spent quite a while with this. Next time please share links to your tests or code in the ticket.
git bisect confirmed this is a regression in e626716c28b6286f8cf0f8174077f3d2244f3eb3 (ref #34429)
Here is a test case:
tests/auth_tests/test_forms.py