This wouldn't affect any usernames that already exist, and users will
still need to login with the same case that they register with.
--
Ticket URL: <https://code.djangoproject.com/ticket/25617>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:1>
* cc: zachborboa@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:2>
* owner: nobody => nmundar
* cc: nmundar@… (added)
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:3>
* Attachment "ticket_25617.patch" added.
Comment (by nmundar):
It's possible to achieve the effect described in this ticket by raising
ValidationError in UserCreationForm.clean_username. However, this
introduces one additional side-effect in tests of password validation
logic. UserAttributeSimilarityValidator will not be able to check if
username is similar to password because previously raised ValidationError
will make username attribute None in password validator and "The password
is too similar to the username." message will be missing from error list.
Since the username in this case has to be changed anyway, omitting this
message may not be relevant because password similarity check makes sense
only on valid usernames. That's the explanation why
auth_tests.test_forms.UserCreationFormTest.test_validates_password has to
be tweaked in the patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:4>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:5>
Comment (by timgraham):
Are you able to convert the patch into a pull request?
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:6>
Comment (by nmundar):
PR: https://github.com/django/django/pull/5572
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:7>
* needs_better_patch: 0 => 1
Comment:
There's a test failure.
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:8>
* needs_better_patch: 1 => 0
Comment:
It's fixed now, stupid mistake. Previous form data that I've used didn't
trigger password length validation.
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:9>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:10>
* cc: berker.peksag@… (added)
Comment:
Looking at https://github.com/django/django/pull/5572 again, I'd suggest
the following API:
* Adding a `clean_username` method would make `UserCreationForm` less
subclass friendly. I'd suggest rename `UserCreationForm` to
`BaseUserCreationForm` and document it as a preferred way to extend user
creation form
* Add a `clean_username` method to `UserCreationForm` (it will be a
subclass of `BaseUserCreationForm`)
Thoughts?
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:11>
* cc: Kye Russell (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:12>
* cc: René Fleschenberg (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:13>
* owner: Neven Munđar => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:14>
* owner: (none) => Paul Schilling
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:15>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:16>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1
Comment:
[https://github.com/django/django/pull/16103 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:17>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:18>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:19>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"298d02a77a69321af8c0023df3250663e9d1362d" 298d02a7]:
{{{
#!CommitTicketReference repository=""
revision="298d02a77a69321af8c0023df3250663e9d1362d"
Fixed #25617 -- Added case-insensitive unique username validation in
UserCreationForm.
Co-Authored-By: Neven Mundar <nmu...@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25617#comment:20>