#19368 closed Cleanup/optimization (fixed)
Custom User without username and with USERNAME_FIELD = 'email', but still see username error message at the admin login page
Reported by: | Val Neekman | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.5-alpha-1 |
Severity: | Release blocker | Keywords: | custom user, USERNAME_FIELD, username |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
Have a custom user with no username and have set USERNAME_FIELD = 'email'.
All works great, however, the error messages are still pointing to the username even though the custom user had no username field.
Here is where the error message comes from.
ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password "
"for a staff account. Note that both fields are case-sensitive.")
Attachments (2)
Change History (11)
by , 12 years ago
Attachment: | django_admin.png added |
---|
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
This message is hardcoded in django.contrib.admin.forms.AdminAuthenticationForm
.
AdminAuthenticationForm
inherits django.contrib.auth.forms.AuthenticationForm
. That class is aware of custom user models: it sets an appropriate label on the username field.
AdminAuthenticationForm
should reflect this. Replacing "username and password" by "credentials" should suffice.
by , 12 years ago
Attachment: | 19368.patch added |
---|
comment:2 by , 12 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Trivial patch attached, I'll just wait for a few days to see in case Russell disagrees.
This should be committed before the string freeze.
comment:3 by , 12 years ago
Severity: | Normal → Release blocker |
---|
comment:4 by , 12 years ago
I'd only add that the language should be changed to say "Note that fields *may* be case-sensitive" which is sort of a cop out - but we now can't know the implementation, and it at least gives the user a heads up if they are forgetting that - esp for hidden PW field.
comment:5 by , 12 years ago
Rather than try to find a generic term, we can substitute the name of the username field as an argument to the error message. The patch isn't that complicated, either; I'll commit shortly.
comment:6 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Admin Login with Email still warns about username