File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 27
27
def stronghold_public (view_func ):
28
28
return view_func
29
29
30
+ try :
31
+ from django .contrib .auth .decorators import login_not_required
32
+ except ImportError :
33
+ def login_not_required (view_func ):
34
+ return view_func
35
+
30
36
31
37
class LoginView (DjangoLoginView ):
32
38
def no_key_exists (self , form ):
@@ -90,6 +96,7 @@ def form_valid(self, form):
90
96
return super ().form_valid (form )
91
97
92
98
99
+ @method_decorator (login_not_required , name = 'dispatch' )
93
100
@method_decorator (stronghold_public , name = 'dispatch' )
94
101
class MFAAuthView (MFAFormView ):
95
102
form_class = MFAAuthForm
Original file line number Diff line number Diff line change 1
1
from pathlib import Path
2
2
3
+ import django
4
+
3
5
DATABASES = {
4
6
'default' : {
5
7
'ENGINE' : 'django.db.backends.sqlite3' ,
21
23
'mfa.middleware.MFAEnforceMiddleware' ,
22
24
]
23
25
26
+ if django .VERSION >= (5 , 1 ):
27
+ MIDDLEWARE .append ('django.contrib.auth.middleware.LoginRequiredMiddleware' )
28
+
24
29
AUTHENTICATION_BACKENDS = [
25
30
'django.contrib.auth.backends.ModelBackend' ,
26
31
]
You can’t perform that action at this time.
0 commit comments