diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2017-07-17 15:13:25 +0000 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2017-07-17 15:14:02 +0000 |
commit | 74087cff261b32557a78666cb53cf0aeedf46a24 (patch) | |
tree | 981b0f4a1ff378bbd5ecab92907f3a6e4155b94e | |
parent | 3e22fcb28b5cd234513a21675be812f519c88326 (diff) | |
download | ansible-74087cff261b32557a78666cb53cf0aeedf46a24.tar.gz ansible-74087cff261b32557a78666cb53cf0aeedf46a24.tar.xz ansible-74087cff261b32557a78666cb53cf0aeedf46a24.zip |
HyperKitty: disable local signup
Spamming reasons, see puiterwijk.
-rw-r--r-- | roles/mailman/files/django_fedora.py | 16 | ||||
-rw-r--r-- | roles/mailman/templates/settings.py.j2 | 7 |
2 files changed, 21 insertions, 2 deletions
diff --git a/roles/mailman/files/django_fedora.py b/roles/mailman/files/django_fedora.py index b8cda8a07..87fc33924 100644 --- a/roles/mailman/files/django_fedora.py +++ b/roles/mailman/files/django_fedora.py @@ -13,3 +13,19 @@ def exclude_useless_errors(record): if isinstance(exc_value, excluded_class): return False return True + + +# Disable local signup + +from allauth.account.adapter import DefaultAccountAdapter +from allauth.socialaccount.adapter import DefaultSocialAccountAdapter + +class NoLocalSignUpAdapter(DefaultAccountAdapter): + + def is_open_for_signup(self, request): + return False + +class SignUpEnabledSocialAdapter(DefaultSocialAccountAdapter): + + def is_open_for_signup(self, request): + return True diff --git a/roles/mailman/templates/settings.py.j2 b/roles/mailman/templates/settings.py.j2 index 89455760f..19b203999 100644 --- a/roles/mailman/templates/settings.py.j2 +++ b/roles/mailman/templates/settings.py.j2 @@ -6,8 +6,6 @@ Django settings for HyperKitty + Postorius import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) -import django_fedora - # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '{{ mailman_hyperkitty_cookie_key }}' @@ -241,6 +239,9 @@ ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_EMAIL_VERIFICATION = "mandatory" ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https" ACCOUNT_UNIQUE_EMAIL = True +# Disable local signup +ACCOUNT_ADAPTER = "django_fedora.NoLocalSignUpAdapter" +SOCIALACCOUNT_ADAPTER = "django_fedora.SignUpEnabledSocialAdapter" SOCIALACCOUNT_PROVIDERS = { 'openid': { @@ -336,6 +337,8 @@ REST_FRAMEWORK = { } +import django_fedora + # A sample logging configuration. The only tangible logging # performed by this configuration is to send an email to # the site admins on every HTTP 500 error when DEBUG=False. |