diff options
| author | levental <levental@fh-brandenburg.de> | 2016-09-19 14:55:18 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-27 11:59:00 -0400 |
| commit | 617e36dc1ede2a311dfd03f18432b31cbfe4c0f7 (patch) | |
| tree | 38fd43fc044ff923321b444c292686798dfb17bd /django/contrib/auth/base_user.py | |
| parent | f7e91cac689b28fc32ca52cdeac258ec0d58b4fc (diff) | |
Fixed #20705 -- Allowed using PasswordResetForm with user models with an email field not named 'email'.
Diffstat (limited to 'django/contrib/auth/base_user.py')
| -rw-r--r-- | django/contrib/auth/base_user.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/django/contrib/auth/base_user.py b/django/contrib/auth/base_user.py index de069659e1..9ad5cde87f 100644 --- a/django/contrib/auth/base_user.py +++ b/django/contrib/auth/base_user.py @@ -138,5 +138,12 @@ class AbstractBaseUser(models.Model): return salted_hmac(key_salt, self.password).hexdigest() @classmethod + def get_email_field_name(cls): + try: + return cls.EMAIL_FIELD + except AttributeError: + return 'email' + + @classmethod def normalize_username(cls, username): return unicodedata.normalize('NFKC', force_text(username)) |
