1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #25617 -- Added case-insensitive unique username validation in UserCreationForm.

Co-Authored-By: Neven Mundar <nmundar@gmail.com>
This commit is contained in:
Paul Schilling
2022-09-24 15:26:14 +01:00
committed by Mariusz Felisiak
parent 1833eb3f3e
commit 298d02a77a
4 changed files with 79 additions and 28 deletions

View File

@@ -1654,9 +1654,12 @@ provides several built-in forms located in :mod:`django.contrib.auth.forms`:
A form used in the admin interface to change a user's information and
permissions.
.. class:: UserCreationForm
.. class:: BaseUserCreationForm
A :class:`~django.forms.ModelForm` for creating a new user.
.. versionadded:: 4.2
A :class:`~django.forms.ModelForm` for creating a new user. This is the
recommended base class if you need to customize the user creation form.
It has three fields: ``username`` (from the user model), ``password1``,
and ``password2``. It verifies that ``password1`` and ``password2`` match,
@@ -1665,11 +1668,19 @@ provides several built-in forms located in :mod:`django.contrib.auth.forms`:
sets the user's password using
:meth:`~django.contrib.auth.models.User.set_password()`.
.. class:: UserCreationForm
Inherits from :class:`BaseUserCreationForm`. To help prevent confusion with
similar usernames, the form doesn't allow usernames that differ only in
case.
.. versionchanged:: 4.2
In older versions, :class:`UserCreationForm` didn't save many-to-many
form fields for a custom user model.
In older versions, usernames that differ only in case are allowed.
.. currentmodule:: django.contrib.auth
Authentication data in templates