From 7dd8350cec573b9fa2212093b705626e5e26c4e0 Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 16 Sep 2024 02:52:35 +0200 Subject: [PATCH] fix(admin_login): redirect authenticated users away to prevent loop --- lelcsc/core/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lelcsc/core/views.py b/lelcsc/core/views.py index d613d1e..c2d8ca7 100644 --- a/lelcsc/core/views.py +++ b/lelcsc/core/views.py @@ -14,6 +14,9 @@ def unauthorized(request): def admin_login(request): + if request.user.is_authenticated: + return redirect("unauthorized") + query = "" if next := request.GET.get("next"): q = QueryDict(mutable=True)