core -- Install django-allauth-ens

Refer to allauth doc for an accurate features list:
  http://django-allauth.readthedocs.io/en/latest/

Users can now change their password, ask for a password reset, or set
one if they don't have one.

In particular, it allows users whose account has been created via a
clipper authentication to configure a password before losing their
clipper. Even if they have already lost it, they are able to get one
using the "Reset password" functionality.

Allauth multiple emails management is deactivated. Requests to the
related url redirect to the home page.

All the login and logout views are replaced by the allauth' ones. It
also concerns the Django and Wagtail admin sites.

Note that users are no longer logged out of the clipper CAS server when
they authenticated via this server. Instead a message suggests the user
to disconnect.

Clipper connections and `login_clipper`
---------------------------------------

- Non-empty `login_clipper` are now unique among `CofProfile` instances.
- They are created once for users with a non-empty 'login_clipper' (with
the data migration 0014_create_clipper_connections).
- The `login_clipper` of CofProfile instances are sync with their
clipper connections:
    * `CofProfile.sync_clipper_connections` method updates the
connections based on `login_clipper`.
    * Signals receivers `sync_clipper…` update `login_clipper` based on
connections creations/updates/deletions.

Misc
----

- Add NullCharField (model field) which allows to use `unique=True` on
CharField (even with empty strings).
- Parts of kfet mixins for TestCase are now in shared.tests.testcase,
  as they are used elsewhere than in the kfet app.
This commit is contained in:
Aurélien Delobelle 2017-10-19 01:12:52 +02:00 committed by Aurélien Delobelle
parent 49a74e8e1e
commit 05eeb6a25c
29 changed files with 877 additions and 504 deletions

View file

@ -69,7 +69,6 @@ INSTALLED_APPS = [
"django.contrib.admindocs",
"bda",
"captcha",
"django_cas_ng",
"bootstrapform",
"kfet",
"kfet.open",
@ -95,6 +94,12 @@ INSTALLED_APPS = [
"kfet.auth",
"kfet.cms",
"corsheaders",
"allauth_ens",
"allauth_cas",
"allauth",
"allauth.account",
"allauth.socialaccount",
"allauth_ens.providers.clipper",
]
MIDDLEWARE = [
@ -182,22 +187,26 @@ MAIL_DATA = {
},
}
LOGIN_URL = "cof-login"
LOGIN_REDIRECT_URL = "home"
CAS_SERVER_URL = "https://cas.eleves.ens.fr/"
CAS_VERSION = "3"
CAS_LOGIN_MSG = None
CAS_IGNORE_REFERER = True
CAS_REDIRECT_URL = "/"
CAS_EMAIL_FORMAT = "%s@clipper.ens.fr"
# Authentication
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth
# https://django-allauth.readthedocs.io/en/latest/index.html
AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
"gestioncof.shared.COFCASBackend",
"allauth.account.auth_backends.AuthenticationBackend",
"kfet.auth.backends.GenericBackend",
)
LOGIN_URL = "account_login"
LOGIN_REDIRECT_URL = "home"
ACCOUNT_LOGOUT_REDIRECT_URL = "home"
ACCOUNT_ADAPTER = "shared.allauth_adapter.AccountAdapter"
ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS = False
ACCOUNT_HOME_URL = "home"
ACCOUNT_USER_DISPLAY = lambda u: u.get_short_name() or u.username
SOCIALACCOUNT_ADAPTER = "shared.allauth_adapter.SocialAccountAdapter"
# reCAPTCHA settings
# https://github.com/praekelt/django-recaptcha