Add two factor dependency
This commit is contained in:
parent
0e8380ffd8
commit
25e0bc1197
4 changed files with 126 additions and 1 deletions
|
|
@ -42,6 +42,10 @@ INSTALLED_APPS = [
|
|||
"django_celery_beat",
|
||||
"registration",
|
||||
"axes",
|
||||
"django_otp",
|
||||
"django_otp.plugins.otp_static",
|
||||
"django_otp.plugins.otp_totp",
|
||||
"two_factor",
|
||||
# app modules
|
||||
"newsreader.accounts",
|
||||
"newsreader.utils",
|
||||
|
|
@ -61,6 +65,7 @@ MIDDLEWARE = [
|
|||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django_otp.middleware.OTPMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
"axes.middleware.AxesMiddleware",
|
||||
|
|
@ -182,6 +187,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
# Authentication user model
|
||||
AUTH_USER_MODEL = "accounts.User"
|
||||
|
||||
LOGIN_URL = "two_factor:login"
|
||||
LOGIN_REDIRECT_URL = "/"
|
||||
|
||||
# Internationalization
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from django.urls import include, path
|
|||
|
||||
from drf_yasg import openapi
|
||||
from drf_yasg.views import get_schema_view
|
||||
from two_factor.urls import urlpatterns as two_factor_urls
|
||||
|
||||
from newsreader.accounts.urls import urlpatterns as login_urls
|
||||
from newsreader.news.core.views import NewsView
|
||||
|
|
@ -18,6 +19,7 @@ schema_info = openapi.Info(title="Newsreader API", default_version="v1")
|
|||
schema_view = get_schema_view(schema_info, patterns=api_patterns)
|
||||
|
||||
urlpatterns = [
|
||||
path("", include(two_factor_urls)),
|
||||
path("", login_required(NewsView.as_view()), name="index"),
|
||||
path("", include((news_patterns, "news"))),
|
||||
path("", include((api_patterns, "api"))),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue