From f9ceb2d86ab8d8adbfc28040071f7ac8a0731fb1 Mon Sep 17 00:00:00 2001 From: Jamie Lennox Date: Thu, 5 Feb 2015 09:25:24 +0000 Subject: [PATCH] Redirect initial hit to login page By rendering the login page within the GET / path we cannot trap the /auth location from horizon to allow us to setup kerberos and other REMOTE_USER tasks on that path. On initial unauthenticated request redirect the user to /auth/login. Change-Id: Ibe577672fc67a33460ea5d8726925b7e4b2a65e9 Closes-Bug: #1418440 --- openstack_dashboard/views.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/openstack_dashboard/views.py b/openstack_dashboard/views.py index dd14f7f4ca..6a252ec9e0 100644 --- a/openstack_dashboard/views.py +++ b/openstack_dashboard/views.py @@ -17,8 +17,7 @@ import django.views.decorators.vary import horizon from horizon import base - -from openstack_auth import forms +from horizon import exceptions def get_user_home(user): @@ -37,11 +36,10 @@ def get_user_home(user): @django.views.decorators.vary.vary_on_cookie def splash(request): - if request.user.is_authenticated(): - response = shortcuts.redirect(horizon.get_user_home(request.user)) - else: - form = forms.Login(request) - response = shortcuts.render(request, 'auth/login.html', {'form': form}) + if not request.user.is_authenticated(): + raise exceptions.NotAuthenticated() + + response = shortcuts.redirect(horizon.get_user_home(request.user)) if 'logout_reason' in request.COOKIES: response.delete_cookie('logout_reason') return response