Skip to content

Commit

Permalink
django 5.1: support LoginRequiredMiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
xi committed Jun 18, 2024
1 parent 48dd370 commit 6d3c916
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mfa/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
def stronghold_public(view_func):
return view_func

try:
from django.contrib.auth.decorators import login_not_required
except ImportError:
def login_not_required(view_func):
return view_func


class LoginView(DjangoLoginView):
def no_key_exists(self, form):
Expand Down Expand Up @@ -90,6 +96,7 @@ def form_valid(self, form):
return super().form_valid(form)


@method_decorator(login_not_required, name='dispatch')
@method_decorator(stronghold_public, name='dispatch')
class MFAAuthView(MFAFormView):
form_class = MFAAuthForm
Expand Down

0 comments on commit 6d3c916

Please sign in to comment.