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
This commit is contained in:
Jamie Lennox 2015-02-05 09:25:24 +00:00
parent c30ff07a53
commit f9ceb2d86a

View File

@ -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