mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 04:25:42 +00:00
clean allauth_2fa reference
This commit is contained in:
@ -12,7 +12,6 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from allauth.account.adapter import DefaultAccountAdapter
|
from allauth.account.adapter import DefaultAccountAdapter
|
||||||
from allauth.account.forms import LoginForm, SignupForm, set_form_field_order
|
from allauth.account.forms import LoginForm, SignupForm, set_form_field_order
|
||||||
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
|
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
|
||||||
from allauth_2fa.forms import TOTPDeviceForm
|
|
||||||
|
|
||||||
import InvenTree.helpers_model
|
import InvenTree.helpers_model
|
||||||
import InvenTree.sso
|
import InvenTree.sso
|
||||||
@ -84,16 +83,6 @@ class CustomSignupForm(SignupForm):
|
|||||||
return cleaned_data
|
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():
|
def registration_enabled():
|
||||||
"""Determine whether user registration is enabled."""
|
"""Determine whether user registration is enabled."""
|
||||||
if (
|
if (
|
||||||
|
Reference in New Issue
Block a user