diff --git a/idhub/templates/auth/login.html b/idhub/templates/auth/login.html index 28c199e..8ae5822 100644 --- a/idhub/templates/auth/login.html +++ b/idhub/templates/auth/login.html @@ -4,8 +4,6 @@ {% block login_content %}
{% csrf_token %} - -
diff --git a/idhub/views.py b/idhub/views.py index 53db736..5f6fb71 100644 --- a/idhub/views.py +++ b/idhub/views.py @@ -13,16 +13,16 @@ class LoginView(auth_views.LoginView): } def get(self, request, *args, **kwargs): - if request.GET.get('next'): - self.extra_context['success_url'] = request.GET.get('next') + self.extra_context['success_url'] = request.GET.get( + 'next', + reverse_lazy('idhub:user_dashboard') + ) return super().get(request, *args, **kwargs) def form_valid(self, form): user = form.get_user() if not user.is_anonymous and user.is_admin: - user_dashboard = reverse_lazy('idhub:user_dashboard') admin_dashboard = reverse_lazy('idhub:admin_dashboard') - if self.extra_context['success_url'] == user_dashboard: - self.extra_context['success_url'] = admin_dashboard + self.extra_context['success_url'] = admin_dashboard auth_login(self.request, user) return HttpResponseRedirect(self.extra_context['success_url'])