- commit
- f655cffef62c977820d27b1cab82dd62edc419f8
- parent
- ee12d1a44a776fa350c7eb243ed969523668edcc
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-06-18 17:25
refactor: use stronghold decorator
Diffstat
| M | mfa/mixins.py | 4 | ---- |
| M | mfa/views.py | 9 | ++++++--- |
2 files changed, 6 insertions, 7 deletions
diff --git a/mfa/mixins.py b/mfa/mixins.py
@@ -10,10 +10,6 @@ from .methods import recovery 10 10 from .methods import totp 11 11 12 1213 -1 class DummyMixin:14 -1 pass15 -116 -117 13 class MFAFormView(FormView): 18 14 @property 19 15 def method(self):
diff --git a/mfa/views.py b/mfa/views.py
@@ -8,6 +8,7 @@ from django.http import Http404 8 8 from django.shortcuts import get_object_or_404 9 9 from django.shortcuts import redirect 10 10 from django.urls import reverse -1 11 from django.utils.decorators import method_decorator 11 12 from django.utils.functional import cached_property 12 13 from django.utils.translation import gettext_lazy as _ 13 14 from django.views.generic import DeleteView @@ -21,9 +22,10 @@ from .mixins import MFAFormView 21 22 from .models import MFAKey 22 23 23 24 try:24 -1 from stronghold.views import StrongholdPublicMixin-1 25 from stronghold.decorators import public as stronghold_public 25 26 except ImportError:26 -1 from .mixins import DummyMixin as StrongholdPublicMixin-1 27 def stronghold_public(view_func): -1 28 return view_func 27 29 28 30 29 31 class LoginView(DjangoLoginView): @@ -88,7 +90,8 @@ class MFACreateView(LoginRequiredMixin, MFAFormView): 88 90 return super().form_valid(form) 89 91 90 9291 -1 class MFAAuthView(StrongholdPublicMixin, MFAFormView):-1 93 @method_decorator(stronghold_public, name='dispatch') -1 94 class MFAAuthView(MFAFormView): 92 95 form_class = MFAAuthForm 93 96 94 97 def get_template_names(self):