From 01eb3b346845a0f1a43d9f8ee4edec822edabd0f Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 30 Jan 2024 19:35:29 +0100 Subject: [PATCH] fix bug about session without logout --- idhub/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/idhub/views.py b/idhub/views.py index 7a525b1..9c2d595 100644 --- a/idhub/views.py +++ b/idhub/views.py @@ -28,6 +28,12 @@ class LoginView(auth_views.LoginView): 'next', reverse_lazy('idhub:user_dashboard') ) + if not self.request.user.is_anonymous: + if self.request.user.is_admin: + return redirect(reverse_lazy('idhub:admin_dashboard')) + else: + return redirect(reverse_lazy('idhub:user_dashboard')) + return super().get(request, *args, **kwargs) def form_valid(self, form):