diff --git a/README.rst b/README.rst index f88eb4a..9128be1 100644 --- a/README.rst +++ b/README.rst @@ -24,8 +24,7 @@ ============ Postorius requires Python 2.7 or newer and mailmanclient, -the official Python bindings for GNU Mailman, it also requires -django-browserid. +the official Python bindings for GNU Mailman. The minimum Django version is 1.8. Postorius needs a running version of GNU Mailman version 3. diff --git a/example_project/settings.py b/example_project/settings.py index 1146d54..ca985b1 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -39,12 +39,14 @@ SECRET_KEY = '$!-7^wl#wiifjbh)5@f7ji%x!vp7s1vzbvwt26hxv$idixq0u0' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False ADMINS = ( #('Admin', 'webmaster@example.com'), ) +SITE_ID = 1 + ALLOWED_HOSTS = [] # Mailman API credentials @@ -60,13 +62,24 @@ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', + 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'postorius', 'django_mailman3', - 'django_browserid', + 'allauth', + 'allauth.account', + 'allauth.socialaccount', + 'allauth.socialaccount.providers.openid', + 'allauth.socialaccount.providers.github', + 'allauth.socialaccount.providers.gitlab', + 'allauth.socialaccount.providers.google', + #'allauth.socialaccount.providers.facebook', + 'allauth.socialaccount.providers.twitter', + 'allauth.socialaccount.providers.stackexchange', ) + MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', @@ -84,6 +97,7 @@ # is the only app you want to serve. ROOT_URLCONF = 'urls' + TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', @@ -165,18 +179,16 @@ # Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = '/static/' -LOGIN_URL = 'user_login' +LOGIN_URL = 'account_login' LOGIN_REDIRECT_URL = 'list_index' -LOGOUT_URL = 'user_logout' +LOGOUT_URL = 'account_logout' -# Use the email username as identifier, but truncate it because -# the User.username field is only 30 chars long. -def username(email): - return email.rsplit('@', 1)[0][:30] -BROWSERID_USERNAME_ALGO = username - +# From Address for emails sent to users +DEFAULT_FROM_EMAIL = 'postorius@localhost.local' +# From Address for emails sent to admins +SERVER_EMAIL = 'root@localhost.local' # Compatibility with Bootstrap 3 from django.contrib.messages import constants as messages MESSAGE_TAGS = { @@ -185,15 +197,45 @@ AUTHENTICATION_BACKENDS = ( - 'django_browserid.auth.BrowserIDBackend', 'django.contrib.auth.backends.ModelBackend', + 'allauth.account.auth_backends.AuthenticationBackend', ) +# Django Allauth +ACCOUNT_AUTHENTICATION_METHOD = "username_email" +ACCOUNT_EMAIL_REQUIRED = True +ACCOUNT_EMAIL_VERIFICATION = "mandatory" +ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https" +ACCOUNT_UNIQUE_EMAIL = True -# From Address for emails sent to users -DEFAULT_FROM_EMAIL = 'postorius@localhost.local' -# From Address for emails sent to admins -SERVER_EMAIL = 'root@localhost.local' +SOCIALACCOUNT_PROVIDERS = { + 'openid': { + 'SERVERS': [ + dict(id='yahoo', + name='Yahoo', + openid_url='http://me.yahoo.com'), + ], + }, + 'google': { + 'SCOPE': ['profile', 'email'], + 'AUTH_PARAMS': {'access_type': 'online'}, + }, + 'facebook': { + 'METHOD': 'oauth2', + 'SCOPE': ['email'], + 'FIELDS': [ + 'email', + 'name', + 'first_name', + 'last_name', + 'locale', + 'timezone', + ], + 'VERSION': 'v2.4', + }, +} + + # These can be set to override the defaults but are not mandatory: # EMAIL_CONFIRMATION_TEMPLATE = 'postorius/address_confirmation_message.txt' @@ -218,9 +260,5 @@ 'handlers': ['console'], 'level': 'INFO', }, - 'django_browserid': { - 'handlers': ['console'], - 'level': 'INFO', - }, }, } diff --git a/example_project/urls.py b/example_project/urls.py index 57e1492..0d2be03 100644 --- a/example_project/urls.py +++ b/example_project/urls.py @@ -18,15 +18,17 @@ from django.conf.urls import include, url - from django.contrib import admin -admin.autodiscover() - -from postorius.views import list as list_views +from django.core.urlresolvers import reverse_lazy +from django.views.generic import RedirectView urlpatterns = [ - url(r'^admin/', include(admin.site.urls)), - url('', include('django_browserid.urls')), - url(r'^$', list_views.list_index), + url(r'^$', RedirectView.as_view( + url=reverse_lazy('postorius.views.list.list_index'), + permanent=True)), url(r'^postorius/', include('postorius.urls')), + #url(r'^hyperkitty/', include('hyperkitty.urls')), + url(r'^accounts/', include('allauth.urls')), + # Django admin + url(r'^admin/', include(admin.site.urls)), ] diff --git a/setup.py b/setup.py index 81c41ef..832ad45 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,6 @@ 'Django>=1.8', 'Django<1.10', 'django-mailman3', - 'django-browserid', 'mailmanclient', ], ) diff --git a/tox.ini b/tox.ini index d37bd48..b014688 100644 --- a/tox.ini +++ b/tox.ini @@ -43,7 +43,6 @@ [testenv:pep8] basepython = python2.7 deps = - {[base]deps} flake8 commands = flake8 {posargs}