Login ou mot de passe incorrect
- {% endif %} - - {% if next %} - {% if user.is_authenticated %} -Accès non autorisé.
- {% else %} -Merci de vous connecter.
- {% endif %} - {% endif %} - - -diff --git a/gestiojeux/urls.py b/gestiojeux/urls.py index 508755d..b0715b2 100644 --- a/gestiojeux/urls.py +++ b/gestiojeux/urls.py @@ -21,9 +21,8 @@ from django.conf.urls.static import static urlpatterns = [ path("admin/", admin.site.urls), path("inventory/", include("inventory.urls")), - path("accounts/", include("gestiojeux_auth.urls")), + path("auth/", include("gestiojeux_auth.urls")), path("", include("mainsite.urls")), - ] if settings.DEBUG: diff --git a/gestiojeux_auth/admin.py b/gestiojeux_auth/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/gestiojeux_auth/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/gestiojeux_auth/apps.py b/gestiojeux_auth/apps.py index 2da02b9..08fa15c 100644 --- a/gestiojeux_auth/apps.py +++ b/gestiojeux_auth/apps.py @@ -2,8 +2,4 @@ from django.apps import AppConfig class GestiojeuxAuthConfig(AppConfig): - name = 'gestiojeux_auth' - - def ready(self): - from . import signals - + name = "gestiojeux_auth" diff --git a/gestiojeux_auth/cas_backend.py b/gestiojeux_auth/cas_backend.py index eb590fc..fdb5c14 100644 --- a/gestiojeux_auth/cas_backend.py +++ b/gestiojeux_auth/cas_backend.py @@ -12,4 +12,3 @@ class GestioJeuxCASBackend(CASBackend): casUser = CasUser(user=user) casUser.save() return user - diff --git a/gestiojeux_auth/templates/registration/login.html b/gestiojeux_auth/templates/registration/login.html new file mode 100644 index 0000000..baa49f9 --- /dev/null +++ b/gestiojeux_auth/templates/registration/login.html @@ -0,0 +1,16 @@ +{% extends "small_page.html" %} + +{% block "title" %} +{% endblock %} + +{% block "content" %} +
Si vous êtes exté·e et que vous n'avez pas encore de compte, demandez en un.
+{% endblock %} + diff --git a/gestiojeux_auth/tests.py b/gestiojeux_auth/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/gestiojeux_auth/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/gestiojeux_auth/urls.py b/gestiojeux_auth/urls.py index ab03bc9..05a5d80 100644 --- a/gestiojeux_auth/urls.py +++ b/gestiojeux_auth/urls.py @@ -1,6 +1,6 @@ from django.urls import include, path import django.contrib.auth.views as dj_auth_views -from .views import login, logout +from .views import login, logout import django_cas_ng.views app_name = "gestiojeux_auth" @@ -23,5 +23,5 @@ accounts_patterns = [ ] urlpatterns = [ - path("", include(accounts_patterns)), + path("", include(accounts_patterns)), ] diff --git a/gestiojeux_auth/views.py b/gestiojeux_auth/views.py index e02b196..16b3ed6 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, "login_switch.html", context=context) + return render(req, "registration/login_switch.html", context=context) @login_required @@ -38,6 +38,15 @@ def logout(req): CAS_BACKEND_NAME = "django_cas_ng.backends.CASBackend" if req.session["_auth_user_backend"] != CAS_BACKEND_NAME: auth_logout(req) + if "next" in req.GET: + return redirect(req.GET["next"]) return redirect("mainsite:home") - return redirect("gestiojeux_auth:cas_ng_logout") + if "next" in req.GET: + return redirect( + "{}?next={}".format( + reverse("gestiojeux_auth:cas_ng_logout"), + urlquote(req.GET["next"], safe=""), + ) + ) + return redirect("gestiojeux_auth:cas_ng_logout") diff --git a/inventory/templates/inventory/game.html b/inventory/templates/inventory/game.html index 92412a9..c5cf165 100644 --- a/inventory/templates/inventory/game.html +++ b/inventory/templates/inventory/game.html @@ -1,14 +1,12 @@ {% extends "base.html" %} -{% block "title" %} - Inventaire du club Jeux -{% endblock %} - {% block "content" %} -{{ game.category }}
diff --git a/inventory/templates/inventory/inventory.html b/inventory/templates/inventory/inventory.html index 3962806..2b25794 100644 --- a/inventory/templates/inventory/inventory.html +++ b/inventory/templates/inventory/inventory.html @@ -1,14 +1,12 @@ {% extends "base.html" %} -{% block "title" %} - Inventaire du club Jeux -{% endblock %} - {% block "content" %} +Login ou mot de passe incorrect
- {% endif %} - - {% if next %} - {% if user.is_authenticated %} -Accès non autorisé.
- {% else %} -Merci de vous connecter.
- {% endif %} - {% endif %} - - -