aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/users/adapters.py
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack/users/adapters.py')
-rw-r--r--ctrack/users/adapters.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ctrack/users/adapters.py b/ctrack/users/adapters.py
new file mode 100644
index 0000000..0d206fa
--- /dev/null
+++ b/ctrack/users/adapters.py
@@ -0,0 +1,16 @@
+from typing import Any
+
+from allauth.account.adapter import DefaultAccountAdapter
+from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
+from django.conf import settings
+from django.http import HttpRequest
+
+
+class AccountAdapter(DefaultAccountAdapter):
+ def is_open_for_signup(self, request: HttpRequest):
+ return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)
+
+
+class SocialAccountAdapter(DefaultSocialAccountAdapter):
+ def is_open_for_signup(self, request: HttpRequest, sociallogin: Any):
+ return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)