diff --git a/gestiojeux/settings_base.py b/gestiojeux/settings_base.py index 1d8a5b3..697a044 100644 --- a/gestiojeux/settings_base.py +++ b/gestiojeux/settings_base.py @@ -39,6 +39,7 @@ MIDDLEWARE = [ "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", + 'django_cas_ng.middleware.CASMiddleware' ] ROOT_URLCONF = "gestiojeux.urls" @@ -61,6 +62,11 @@ TEMPLATES = [ WSGI_APPLICATION = "gestiojeux.wsgi.application" +AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'django_cas_ng.backends.CASBackend', +) + # Password validation # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators @@ -78,3 +84,10 @@ AUTH_PASSWORD_VALIDATORS = [ STATIC_URL = "/static/" MEDIA_URL = "/media/" + +CAS_SERVER_URL = "https://cas.eleves.ens.fr/" +CAS_VERSION = "2" +CAS_LOGIN_MSG = None +CAS_IGNORE_REFERER = True +CAS_EMAIL_FORMAT = "%s@clipper.ens.fr" + diff --git a/gestiojeux_auth/migrations/0001_initial.py b/gestiojeux_auth/migrations/0001_initial.py new file mode 100644 index 0000000..199923c --- /dev/null +++ b/gestiojeux_auth/migrations/0001_initial.py @@ -0,0 +1,22 @@ +# Generated by Django 3.1.2 on 2020-10-21 19:57 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('auth', '0012_alter_user_first_name_max_length'), + ] + + operations = [ + migrations.CreateModel( + name='CasUser', + fields=[ + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='auth.user')), + ], + ), + ] diff --git a/gestiojeux_auth/views.py b/gestiojeux_auth/views.py index 331a52a..e02b196 100644 --- a/gestiojeux_auth/views.py +++ b/gestiojeux_auth/views.py @@ -30,7 +30,7 @@ def login(req): "cas_url": reverse("gestiojeux_auth:cas_ng_login"), } - return render(req, "registration/login_switch.html", context=context) + return render(req, "login_switch.html", context=context) @login_required diff --git a/inventory/migrations/0002_auto_20201021_2157.py b/inventory/migrations/0002_auto_20201021_2157.py new file mode 100644 index 0000000..8effd80 --- /dev/null +++ b/inventory/migrations/0002_auto_20201021_2157.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.2 on 2020-10-21 19:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('inventory', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='game', + name='image', + field=models.ImageField(blank=True, upload_to='game_img/', verbose_name='image'), + ), + ] diff --git a/mainsite/templates/403.html b/mainsite/templates/403.html index d8ec6b4..e3618b2 100644 --- a/mainsite/templates/403.html +++ b/mainsite/templates/403.html @@ -1,4 +1,4 @@ -{% extends "base_minimal.html" %} +{% extends "base.html" %} {% block "content" %}