aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/users/adapters.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-01-19 15:57:06 +0000
committerMatthew Lemon <lemon@matthewlemon.com>2020-01-19 15:57:06 +0000
commit9d76a3c52b8310726ec09e0262813f0438c21df6 (patch)
tree4acf47dce6c3aa75f8ad7c5cb56fe6486c2d64a7 /ctrack/users/adapters.py
init commit - from cookiecutter
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)