fix bug about session without logout

This commit is contained in:
Cayo Puigdefabregas 2024-01-30 19:35:29 +01:00
parent 732cb53fb3
commit 01eb3b3468
1 changed files with 6 additions and 0 deletions

View File

@ -28,6 +28,12 @@ class LoginView(auth_views.LoginView):
'next', 'next',
reverse_lazy('idhub:user_dashboard') 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) return super().get(request, *args, **kwargs)
def form_valid(self, form): def form_valid(self, form):