mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
parent
fe68dc7318
commit
c79fc281fd
@ -117,7 +117,7 @@ def registration_enabled():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class RegistratonMixin:
|
class RegistrationMixin:
|
||||||
"""Mixin to check if registration should be enabled."""
|
"""Mixin to check if registration should be enabled."""
|
||||||
|
|
||||||
def is_open_for_signup(self, request, *args, **kwargs):
|
def is_open_for_signup(self, request, *args, **kwargs):
|
||||||
@ -188,7 +188,7 @@ class CustomUrlMixin:
|
|||||||
|
|
||||||
|
|
||||||
class CustomAccountAdapter(
|
class CustomAccountAdapter(
|
||||||
CustomUrlMixin, RegistratonMixin, OTPAdapter, DefaultAccountAdapter
|
CustomUrlMixin, RegistrationMixin, OTPAdapter, DefaultAccountAdapter
|
||||||
):
|
):
|
||||||
"""Override of adapter to use dynamic settings."""
|
"""Override of adapter to use dynamic settings."""
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ class CustomAccountAdapter(
|
|||||||
|
|
||||||
|
|
||||||
class CustomSocialAccountAdapter(
|
class CustomSocialAccountAdapter(
|
||||||
CustomUrlMixin, RegistratonMixin, DefaultSocialAccountAdapter
|
CustomUrlMixin, RegistrationMixin, DefaultSocialAccountAdapter
|
||||||
):
|
):
|
||||||
"""Override of adapter to use dynamic settings."""
|
"""Override of adapter to use dynamic settings."""
|
||||||
|
|
||||||
|
@ -10,19 +10,19 @@ from allauth.socialaccount.models import SocialAccount, SocialLogin
|
|||||||
|
|
||||||
from common.models import InvenTreeSetting
|
from common.models import InvenTreeSetting
|
||||||
from InvenTree import sso
|
from InvenTree import sso
|
||||||
from InvenTree.auth_overrides import RegistratonMixin
|
from InvenTree.auth_overrides import RegistrationMixin
|
||||||
from InvenTree.unit_test import InvenTreeAPITestCase
|
from InvenTree.unit_test import InvenTreeAPITestCase
|
||||||
|
|
||||||
|
|
||||||
class Dummy:
|
class Dummy:
|
||||||
"""Simulate super class of RegistratonMixin."""
|
"""Simulate super class of RegistrationMixin."""
|
||||||
|
|
||||||
def save_user(self, _request, user: User, *args) -> User:
|
def save_user(self, _request, user: User, *args) -> User:
|
||||||
"""This method is only used that the super() call of RegistrationMixin does not fail."""
|
"""This method is only used that the super() call of RegistrationMixin does not fail."""
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
class MockRegistrationMixin(RegistratonMixin, Dummy):
|
class MockRegistrationMixin(RegistrationMixin, Dummy):
|
||||||
"""Mocked implementation of the RegistrationMixin."""
|
"""Mocked implementation of the RegistrationMixin."""
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user