auth.py 1.2 KB
Newer Older
luxcem's avatar
luxcem committed
1 2 3 4 5 6
"""
User registration and login related settings
"""

AUTH_USER_MODEL = "auth.User"
EXTENDED_USER_MODEL = "userprofile.Profile"
7
LOGIN_URL = "/accounts/login"
Okhin's avatar
Okhin committed
8 9
LOGIN_REDIRECT_URL = "/rp/"
LOGOUT_REDIRECT_URL = "/rp/"
luxcem's avatar
luxcem committed
10 11 12 13 14 15 16


AUTHENTICATION_BACKENDS = [
    # Default
    "django.contrib.auth.backends.ModelBackend",
    # Email or Username for login
    "core.auth_backends.EmailOrUsernameModelBackend",
17 18
    # Use django-allauth for authentication
    "allauth.account.auth_backends.AuthenticationBackend",
luxcem's avatar
luxcem committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
]

# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        "NAME": ("django.contrib.auth.password_validation."
                 "UserAttributeSimilarityValidator"),
    },
    {
        "NAME": ("django.contrib.auth.password_validation."
                 "MinimumLengthValidator"),
    },
    {
        "NAME": ("django.contrib.auth.password_validation."
                 "CommonPasswordValidator"),
    },
    {
        "NAME": ("django.contrib.auth.password_validation."
                 "NumericPasswordValidator"),
    },
]
42 43 44 45


# Disable two steps logout
ACCOUNT_LOGOUT_ON_GET = True
46
ACCOUNT_SIGNUP_FORM_CLASS = "rp.forms.SignupForm"