HyperKitty: disable local signup

Spamming reasons, see puiterwijk.
This commit is contained in:
Aurélien Bompard 2017-07-17 15:13:25 +00:00
parent 3e22fcb28b
commit 74087cff26
2 changed files with 21 additions and 2 deletions

View file

@ -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

View file

@ -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.