From 8318750eb036cb6d1dc6ce54b2f3b6bb0485d696 Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Fri, 20 Oct 2023 16:27:39 +0200 Subject: [PATCH] Add: Redirect logged in users to homepage --- archivist/apps/authentication/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/archivist/apps/authentication/views.py b/archivist/apps/authentication/views.py index d974983..bfcd065 100644 --- a/archivist/apps/authentication/views.py +++ b/archivist/apps/authentication/views.py @@ -5,6 +5,10 @@ from .forms import LoginForm, SignUpForm def login_view(request): + if request.user.is_authenticated: + # User is already logged in, redirect them to the home page + return redirect('/') + form = LoginForm(request.POST or None) msg = None