2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 20:45:44 +00:00

clean allauth_2fa reference

This commit is contained in:
Matthias Mair
2024-12-23 01:33:36 +01:00
parent d23cc870b6
commit b1a549acb8

View File

@ -12,7 +12,6 @@ from django.utils.translation import gettext_lazy as _
from allauth.account.adapter import DefaultAccountAdapter
from allauth.account.forms import LoginForm, SignupForm, set_form_field_order
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from allauth_2fa.forms import TOTPDeviceForm
import InvenTree.helpers_model
import InvenTree.sso
@ -84,16 +83,6 @@ class CustomSignupForm(SignupForm):
return cleaned_data
class CustomTOTPDeviceForm(TOTPDeviceForm):
"""Ensure that db registration is enabled."""
def __init__(self, user, metadata=None, **kwargs):
"""Override to check if registration is open."""
if not settings.MFA_ENABLED:
raise forms.ValidationError(_('MFA Registration is disabled.'))
super().__init__(user, metadata, **kwargs)
def registration_enabled():
"""Determine whether user registration is enabled."""
if (