diff options
Diffstat (limited to 'django/contrib/auth/base_user.py')
| -rw-r--r-- | django/contrib/auth/base_user.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/django/contrib/auth/base_user.py b/django/contrib/auth/base_user.py index c8f748cf02..d168262bb0 100644 --- a/django/contrib/auth/base_user.py +++ b/django/contrib/auth/base_user.py @@ -4,6 +4,8 @@ not in INSTALLED_APPS. """ from __future__ import unicode_literals +import unicodedata + from django.contrib.auth import password_validation from django.contrib.auth.hashers import ( check_password, is_password_usable, make_password, @@ -11,7 +13,7 @@ from django.contrib.auth.hashers import ( from django.db import models from django.utils.crypto import get_random_string, salted_hmac from django.utils.deprecation import CallableFalse, CallableTrue -from django.utils.encoding import python_2_unicode_compatible +from django.utils.encoding import force_text, python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ @@ -31,6 +33,10 @@ class BaseUserManager(models.Manager): email = '@'.join([email_name, domain_part.lower()]) return email + @classmethod + def normalize_username(cls, username): + return unicodedata.normalize('NFKC', force_text(username)) + def make_random_password(self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' |
