accounts, add modal and many more

This commit is contained in:
gw3000 2023-06-11 13:52:42 +02:00
parent 7a4cb2ff67
commit 81dba3e6b3
53 changed files with 829 additions and 19 deletions

View file

@ -39,6 +39,12 @@ INSTALLED_APPS = [
"django.contrib.messages",
"django.contrib.staticfiles",
# -----------------------------------
# All auth
# -----------------------------------
"allauth",
"allauth.account",
"allauth.socialaccount",
# -----------------------------------
# Crispy forms, modals and bootstrap5
# -----------------------------------
"bootstrap_modal_forms",
@ -80,6 +86,13 @@ TEMPLATES = [
},
]
AUTHENTICATION_BACKENDS = [
# Needed to login by username in Django admin, regardless of `allauth`
"django.contrib.auth.backends.ModelBackend",
# allauth specific authentication methods, such as login by e-mail
"allauth.account.auth_backends.AuthenticationBackend",
]
WSGI_APPLICATION = "core.wsgi.application"
@ -139,3 +152,19 @@ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
# crispy forms
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bootstrap5"
# allauth
SITE_ID = 1
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 5
ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = 86400 # 1 day in seconds
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True
ACCOUNT_LOGOUT_REDIRECT_URL = "/"
ACCOUNT_LOGOUT_ON_GET = True
ACCOUNT_SESSION_REMEMBER = True
ACCOUNT_USERNAME_BLACKLIST = ["gw", "admin", "god"]
ACCOUNT_USERNAME_MIN_LENGTH = 3
ACCOUNT_UNIQUE_EMAIL = True
LOGIN_REDIRECT_URL = "/bird/all"