[mailman3] Disable signup on mailman

This module disables signup on mailman web UI.

Signed-off-by: Michal Konecny <mkonecny@redhat.com>
This commit is contained in:
Michal Konecny 2024-04-08 14:06:16 +02:00
parent d9f1031dbc
commit cf48dec0eb
3 changed files with 33 additions and 3 deletions

View file

@ -0,0 +1,14 @@
# 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, sociallogin):
return True

View file

@ -285,6 +285,19 @@
- mailman
- db
- name: Install the fedora-specific modules
ansible.builtin.copy:
src: django_fedora_nosignup.py
dest: "{{ mailman_webui_confdir }}/django_fedora_nosignup.py"
owner: root
group: root
mode: 0644
tags:
- config
- mailman
notify:
- reload apache
#
# Plug HyperKitty into Mailman
#

View file

@ -68,10 +68,10 @@ INSTALLED_APPS = (
'django_q',
'hyperkitty',
'postorius',
{% for service_name, service_data in mailman_login.items() %}
{% for service_name, service_data in mailman_login.items() %}
'allauth.socialaccount.providers.{{ service_data.provider }}',
{% endfor %}
'allauth.socialaccount.providers.openid',
{% endfor %}
'allauth.socialaccount.providers.openid_connect',
)
@ -223,6 +223,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_nosignup.NoLocalSignUpAdapter"
SOCIALACCOUNT_ADAPTER = "django_fedora_nosignup.SignUpEnabledSocialAdapter"
SOCIALACCOUNT_PROVIDERS = {
'openid': {