Début intégration allauth

This commit is contained in:
Evarin 2018-04-18 23:05:15 +02:00
parent cd4fe67929
commit 377cad94ae
4 changed files with 43 additions and 8 deletions

View file

@ -9,7 +9,7 @@ v1_api.register(api.AuteurResource())
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^perso/$', views.perso, name='perso'),
url(r'^compte/profil/$', views.perso, name='perso'),
url(r'^faq/$', views.faq, name='faq'),
url(r'^stage/nouveau/$', views.manage_stage, name='stage_ajout'),
url(r'^stage/(?P<pk>\w+)/$', views.StageView.as_view(), name='stage'),

View file

@ -1,3 +1,4 @@
#coding: utf-8
"""
Django settings for experiENS project.
@ -11,6 +12,7 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from django.core.urlresolvers import reverse_lazy
from django.contrib import messages
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
@ -29,11 +31,19 @@ INSTALLED_APPS = (
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'django.contrib.sites',
'django_elasticsearch_dsl',
'widget_tweaks',
'allauth_ens',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth_cas',
'allauth_ens.providers.clipper',
'tastypie',
'django_cas_ng',
'braces',
'tinymce',
'taggit',
@ -67,6 +77,7 @@ TEMPLATES = [
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
],
},
},
@ -101,9 +112,12 @@ STATIC_URL = '/static/'
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'experiENS.auth.ENSCASBackend',
'allauth.account.auth_backends.AuthenticationBackend',
# 'experiENS.auth.ENSCASBackend',
)
SITE_ID = 1
CAS_SERVER_URL = "https://cas.eleves.ens.fr/" #SPI CAS
CAS_VERIFY_URL = "https://cas.eleves.ens.fr/"
CAS_IGNORE_REFERER = True
@ -114,3 +128,19 @@ CAS_VERSION = 'CAS_2_SAML_1_0'
LOGIN_URL = reverse_lazy('login')
LOGOUT_URL = reverse_lazy('logout')
LOGIN_REDIRECT_URL = reverse_lazy('avisstage:perso')
ACCOUNT_HOME_URL = reverse_lazy('avisstage:perso')
ACCOUNT_DETAILS_URL = reverse_lazy('avisstage:profil_edit')
SOCIALACCOUNT_PROVIDERS = {
# …
'clipper': {
# These settings control whether a message containing a link to
# disconnect from the CAS server is added when users log out.
'MESSAGE_SUGGEST_LOGOUT_ON_LOGOUT': True,
'MESSAGE_SUGGEST_LOGOUT_ON_LOGOUT_LEVEL': messages.INFO,
},
}

View file

@ -2,13 +2,17 @@ from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django_cas_ng import views as django_cas_views
#from django_cas_ng import views as django_cas_views
from allauth_ens.views import capture_login, capture_logout
urlpatterns = [
url(r'^', include('avisstage.urls', namespace='avisstage')),
url(r'^compte/', include('allauth.urls')),
url(r'^login/$', django_cas_views.login, name = "login"),
url(r'^logout/$', django_cas_views.logout, name = "logout"),
url(r'^login/$', capture_login, name="login"),
url(r'^logout/$', capture_logout, name="logout"),
# url(r'^login/$', django_cas_views.login, name = "login"),
# url(r'^logout/$', django_cas_views.logout, name = "logout"),
url(r'^tinymce/', include('tinymce.urls')),
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
url(r'^admin/', include(admin.site.urls)),

View file

@ -1,4 +1,4 @@
django
django==1.11.*
django-cas-ng
django-taggit
python-ldap
@ -8,4 +8,5 @@ django-taggit-autosuggest
pytz
django-tastypie
lxml
git+https://github.com/sabricot/django-elasticsearch-dsl
git+https://github.com/sabricot/django-elasticsearch-dsl#egg=django_elasticsearch_dsl
django-allauth-ens