From ad9181d5de95c8dd356f6e2687769c970ceff9f9 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 27 Sep 2019 16:15:03 +0200 Subject: [PATCH 1/1] Compatibility fixes. --- prawokultury/settings.d/30-apps.py | 2 +- prawokultury/settings.d/40-auth.py | 9 ++++----- prawokultury/settings.d/40-middleware.py | 2 +- prawokultury/settings.d/50-contrib.py | 7 +++++-- prawokultury/urls.py | 10 +++++----- requirements.txt | 4 ++-- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/prawokultury/settings.d/30-apps.py b/prawokultury/settings.d/30-apps.py index 20ffd63..458031b 100644 --- a/prawokultury/settings.d/30-apps.py +++ b/prawokultury/settings.d/30-apps.py @@ -16,7 +16,7 @@ INSTALLED_APPS = ( 'pagination', 'sorl.thumbnail', 'piwik', - 'django_cas', + 'django_cas_ng', 'honeypot', 'taggit', 'taggit_autosuggest', diff --git a/prawokultury/settings.d/40-auth.py b/prawokultury/settings.d/40-auth.py index 14847ac..f7a007a 100644 --- a/prawokultury/settings.d/40-auth.py +++ b/prawokultury/settings.d/40-auth.py @@ -1,5 +1,4 @@ -if 'django_cas' in INSTALLED_APPS: - AUTHENTICATION_BACKENDS = ( - 'django.contrib.auth.backends.ModelBackend', - 'fnpdjango.auth_backends.AttrCASBackend', - ) +AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'django_cas_ng.backends.CASBackend', +) diff --git a/prawokultury/settings.d/40-middleware.py b/prawokultury/settings.d/40-middleware.py index ffbe493..b48e178 100644 --- a/prawokultury/settings.d/40-middleware.py +++ b/prawokultury/settings.d/40-middleware.py @@ -12,7 +12,7 @@ MIDDLEWARE_CLASSES = ( if 'django_cas' in INSTALLED_APPS: MIDDLEWARE_CLASSES += ( - 'django_cas.middleware.CASMiddleware', + 'django_cas_ng.middleware.CASMiddleware', ) MIDDLEWARE_CLASSES += ( diff --git a/prawokultury/settings.d/50-contrib.py b/prawokultury/settings.d/50-contrib.py index 30b1e5b..96107be 100644 --- a/prawokultury/settings.d/50-contrib.py +++ b/prawokultury/settings.d/50-contrib.py @@ -13,8 +13,11 @@ THUMBNAIL_QUALITY = 95 GRAVATAR_DEFAULT_IMAGE = 'http://localhost:8000/static/img/avatar.png' -CAS_SERVER_URL = 'http://logowanie.nowoczesnapolska.org.pl/cas/' -CAS_VERSION = '3' +CAS_SERVER_URL = 'https://logowanie.nowoczesnapolska.org.pl/cas/' +CAS_VERSION = '2' +CAS_APPLY_ATTRIBUTES_TO_USER = True +CAS_RENAME_ATTRIBUTES = { + 'email': 'email', 'firstname': 'first_name', 'lastname': 'last_name'} HONEYPOT_FIELD_NAME='miut' diff --git a/prawokultury/urls.py b/prawokultury/urls.py index 1f83793..07b89c2 100644 --- a/prawokultury/urls.py +++ b/prawokultury/urls.py @@ -30,12 +30,12 @@ if 'django.contrib.sitemaps' in settings.INSTALLED_APPS: }), ) -if 'django_cas' in settings.INSTALLED_APPS: +if 'django_cas_ng' in settings.INSTALLED_APPS: urlpatterns += patterns('', - (r'^accounts/login/$', 'django_cas.views.login'), - (r'^accounts/logout/$', 'django_cas.views.logout'), - (r'^admin/login/$', 'django_cas.views.login'), - (r'^admin/logout/$', 'django_cas.views.logout'), + (r'^accounts/login/$', 'django_cas_ng.views.login'), + (r'^accounts/logout/$', 'django_cas_ng.views.logout'), + (r'^admin/login/$', 'django_cas_ng.views.login'), + (r'^admin/logout/$', 'django_cas_ng.views.logout'), ) urlpatterns += patterns('', diff --git a/requirements.txt b/requirements.txt index 53c4cb6..76422f1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,14 @@ -i https://py.mdrn.pl/simple Django>=1.7,<1.8 -django_cas>=2.1,<2.2 Pillow sorl-thumbnail==12.4.1 django-pagination django-honeypot==0.4.0 +django-cas-ng==3.5.10 django-migdal==0.8.6 -fnpdjango==0.4.1 +fnpdjango[textile]==0.4.1 python-slugify django-markupfield==1.4.3 -- 2.20.1