File tree 2 files changed +10
-0
lines changed
2 files changed +10
-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 21
21
'mfa.middleware.MFAEnforceMiddleware' ,
22
22
]
23
23
24
+ if django .VERSION >= (5 , 1 ):
25
+ MIDDLEWARE .append ('django.contrib.auth.middleware.LoginRequiredMiddleware' )
26
+
24
27
AUTHENTICATION_BACKENDS = [
25
28
'django.contrib.auth.backends.ModelBackend' ,
26
29
]
You can’t perform that action at this time.
0 commit comments