[core] Remove load balancer cookie on login if not authenticated
To rebalance to a new Hue each time a user re-logins.
Check if the user is authenticated so that a relogin while already
logged in does not re-balance.
@@ -173,7 +173,7 @@ def dt_login(request, from_modal=False):
if from_modal:
renderable_path = 'login_modal.mako'
- return render(renderable_path, request, {
+ response = render(renderable_path, request, {
'action': urlresolvers.reverse('desktop.auth.views.dt_login'),
'form': first_user_form or auth_form,
'next': redirect_to,
@@ -183,6 +183,11 @@ def dt_login(request, from_modal=False):
'active_directory': is_active_directory
})
+ if not request.user.is_authenticated():
+ response.delete_cookie(LOAD_BALANCER_COOKIE) # Note: might be re-balanced to another Hue on login.
+
+ return response
+
def dt_logout(request, next_page=None):
"""Log out the user"""
