Opened 21 months ago

Closed 21 months ago

Last modified 21 months 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 Changed 21 months ago by Tim Graham

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 Changed 21 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 40bac28f:

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

comment:3 Changed 21 months ago by Tim Graham <timograham@…>

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