Initial mfa support (for internal users) #93591

Merged
Oleg-Komarov merged 46 commits from mfa into main 2024-08-29 11:44:06 +02:00
Showing only changes of commit 1277d939f8 - Show all commits

View File

@ -47,3 +47,13 @@ class MfaRequiredIfConfiguredMixin(AccessMixin):
return self.handle_no_permission() return self.handle_no_permission()
decorator = otp_required(accept_trusted_agent=True, if_configured=True) decorator = otp_required(accept_trusted_agent=True, if_configured=True)
return decorator(super().dispatch)(request, *args, **kwargs) return decorator(super().dispatch)(request, *args, **kwargs)
class MfaRequiredMixin(AccessMixin):
"""This mixin ensures an mfa check within the session."""
def dispatch(self, request, *args, **kwargs):
if not request.user.is_authenticated:
return self.handle_no_permission()
decorator = otp_required(accept_trusted_agent=False, if_configured=False)
return decorator(super().dispatch)(request, *args, **kwargs)