Code

#19150 closed Cleanup/optimization (fixed)

Presence of USERNAME_FIELD in REQUIRED_FIELDS should be validated

Reported by: russellm Owned by: nobody
Component: contrib.auth Version: 1.4
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Reported via Chris Pagnutti <chris.pagnutti@…> on django-users:

The documentation says that when specifying a custom User model, USERNAME_FIELD *must not* be present in REQUIRED_FIELDS. However, there's no validation that this is actually true.

This is an easy condition to check, so we should do so.

In an ideal world, this validation would be abstracted out to the actual base User model - however, the current validation tools aren't abstracted at all. As a temporary measure, a specific AUTH_USER_MODEL check in validation.py may be required, pending a larger refactor of the validation system.

Marking as release blocker because it's a major improvement to a new feature.

Attachments (0)

Change History (1)

comment:1 Changed 18 months ago by Russell Keith-Magee <russell@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 7a908747a52f7cc12d7006058daad6a6c973c462:

Fixed #19150 -- Added validation for USERNAME_FIELD being included in REQUIRED_FIELDS.

Thanks to Chris Pagnutti for the suggestion.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.