Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#722 closed defect (wontfix)

Allow for period '.' and hyphen '-' characters in usernames with an isUsername validator

Reported by: Ian@… Owned by: adrian
Component: Validators Version:
Severity: normal Keywords: username validation period hyphen
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently restricts usernames by not allowed a '.'.
Can we remove this restriction? as there are several companies out there why my login ID would be either
Ian.Holsman
or
I.Holsman
and I would prefer to use the same ID that I use on my intranet, rather than invent yet another ID for myself.

Thanks
Ian

Attachments (2)

username_re.patch (1.5 KB) - added by ian@… 9 years ago.
patch to allow less restrictive usernames
username.patch (1.9 KB) - added by david@… 9 years ago.
Updates patch to M-R.

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by ian@…

patch to allow less restrictive usernames

comment:1 Changed 9 years ago by adrian

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

Feel free to override auth.User using replaces_module to change the business logic for usernames.

comment:2 Changed 9 years ago by real.human@…

  • Component changed from Admin interface to Validators
  • Keywords username validation period hyphen added
  • Resolution wontfix deleted
  • Status changed from closed to reopened
  • Summary changed from Allow for a period '.' in usernames to Allow for period '.' and hyphen '-' characters in usernames with an isUsername validator

i've been told that "replaces_module" is old functionality that has died and gone away, and i only found one reference to it in a comment in the django documentation.

that being the case and because periods and hyphens are fairly common in usernames in most systems i've used, i'm going to re-open this ticket and request that django.core.validators.isUsername be added and used in django.contrib.auth.models.User.

the patch supplied by the original poster has an error in the regular expression though, the unescaped period will match any character. i'd like to see at least letters, numbers, periods, hyphens, and underscores allowed in a username. any extras (such as @, included in the original patch) wouldn't hurt, but i don't think we need to allow emails as usernames since we already have an email field.

comment:3 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from reopened to closed

To work around this, you can use a different authentication backend -- see the http://www.djangoproject.com/documentation/authentication/#other-authentication-sources page. It's a bit of a hoop to jump through, but we can't please everybody with the default username validation.

Changed 9 years ago by david@…

Updates patch to M-R.

comment:4 Changed 9 years ago by david@…

I'd just like to point out that it seems pretty counter-intuitive to have an isUsername validator, but use isAlphaNumeric to validate usernames. I think an additional auth backend is a pretty big hoop compared to this change.

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