-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Don't import mfa/socialaccount models when not installed
- Loading branch information
Showing
7 changed files
with
125 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
from pathlib import Path | ||
|
||
from django.contrib.auth.hashers import PBKDF2PasswordHasher | ||
|
||
|
||
SECRET_KEY = "psst" | ||
SITE_ID = 1 | ||
ALLOWED_HOSTS = ( | ||
"testserver", | ||
"example.com", | ||
) | ||
USE_I18N = False | ||
USE_TZ = True | ||
|
||
DATABASES = { | ||
"default": { | ||
"ENGINE": "django.db.backends.sqlite3", | ||
"NAME": ":memory:", | ||
"USER": "", | ||
"PASSWORD": "", | ||
"HOST": "", | ||
"PORT": "", | ||
} | ||
} | ||
|
||
ROOT_URLCONF = "tests.account_only.urls" | ||
LOGIN_URL = "/login/" | ||
|
||
TEMPLATES = [ | ||
{ | ||
"BACKEND": "django.template.backends.django.DjangoTemplates", | ||
"DIRS": [Path(__file__).parent / "templates"], | ||
"APP_DIRS": True, | ||
"OPTIONS": { | ||
"context_processors": [ | ||
"django.template.context_processors.debug", | ||
"django.template.context_processors.request", | ||
"django.contrib.auth.context_processors.auth", | ||
"django.contrib.messages.context_processors.messages", | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
CACHES = { | ||
"default": { | ||
"BACKEND": "django.core.cache.backends.dummy.DummyCache", | ||
} | ||
} | ||
|
||
MIDDLEWARE = ( | ||
"django.contrib.sessions.middleware.SessionMiddleware", | ||
"django.middleware.common.CommonMiddleware", | ||
"django.middleware.csrf.CsrfViewMiddleware", | ||
"django.contrib.auth.middleware.AuthenticationMiddleware", | ||
"django.contrib.messages.middleware.MessageMiddleware", | ||
"django.middleware.clickjacking.XFrameOptionsMiddleware", | ||
"allauth.account.middleware.AccountMiddleware", | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
"django.contrib.auth", | ||
"django.contrib.contenttypes", | ||
"django.contrib.sessions", | ||
"django.contrib.sites", | ||
"django.contrib.messages", | ||
"django.contrib.staticfiles", | ||
"django.contrib.admin", | ||
"django.contrib.humanize", | ||
"allauth", | ||
"allauth.account", | ||
) | ||
|
||
AUTHENTICATION_BACKENDS = ( | ||
"django.contrib.auth.backends.ModelBackend", | ||
"allauth.account.auth_backends.AuthenticationBackend", | ||
) | ||
|
||
STATIC_ROOT = "/tmp/" # Dummy | ||
STATIC_URL = "/static/" | ||
|
||
|
||
class MyPBKDF2PasswordHasher(PBKDF2PasswordHasher): | ||
""" | ||
A subclass of PBKDF2PasswordHasher that uses 1 iteration. | ||
This is for test purposes only. Never use anywhere else. | ||
""" | ||
|
||
iterations = 1 | ||
|
||
|
||
PASSWORD_HASHERS = [ | ||
"tests.headless_only.settings.MyPBKDF2PasswordHasher", | ||
"django.contrib.auth.hashers.PBKDF2PasswordHasher", | ||
"django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher", | ||
"django.contrib.auth.hashers.Argon2PasswordHasher", | ||
"django.contrib.auth.hashers.BCryptSHA256PasswordHasher", | ||
] | ||
|
||
|
||
ACCOUNT_LOGIN_BY_CODE_ENABLED = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
429 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.contrib import admin | ||
from django.urls import include, path | ||
|
||
from allauth.account.decorators import secure_admin_login | ||
|
||
|
||
admin.autodiscover() | ||
admin.site.login = secure_admin_login(admin.site.login) | ||
|
||
urlpatterns = [ | ||
path("admin/", admin.site.urls), | ||
path("", include("allauth.urls")), | ||
] |