Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#29176 closed Bug (fixed)

User.normalize_username() crashes if username isn't a string

Reported by: Christophe Mehay Owned by: nobody
Component: contrib.auth Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I use phone_number module for my username field in Auth module and since I migrated my project to django2, the classmethod normalize_username tries to normalise data which are not a string.

A simple patch would be to check username type in this method and normalize only if the type is a string.

Change History (3)

comment:1 by Tim Graham, 7 years ago

Has patch: set
Needs tests: set
Summary: Cannot use a custom username field which is not a stringUser.normalize_username() crashes if username isn't a string
Triage Stage: UnreviewedAccepted

PR (needs a test)

comment:2 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: newclosed

In 40bac28f:

Fixed #29176 -- Fixed AbstractBaseUser.normalize_username() crash if username isn't a string.

comment:3 by Tim Graham <timograham@…>, 7 years ago

In e91ff6e:

[2.0.x] Fixed #29176 -- Fixed AbstractBaseUser.normalize_username() crash if username isn't a string.

Backport of 40bac28faabbacd0875e59455cd80fb1dbb16966 from master

Note: See TracTickets for help on using tickets.
Back to Top