From aa61a491d0369d810c37609d050ed90ab8d09f35 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Tue, 19 Aug 2014 11:08:10 -0400 Subject: [PATCH] Login Attempted fix for https://trello.com/c/dcu8BoSa/307-401-error-on-login --- awx/ui/static/js/controllers/Authentication.js | 4 +++- awx/ui/static/lib/ansible/AuthService.js | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/awx/ui/static/js/controllers/Authentication.js b/awx/ui/static/js/controllers/Authentication.js index d5c4486ae2..cb3f685a3f 100644 --- a/awx/ui/static/js/controllers/Authentication.js +++ b/awx/ui/static/js/controllers/Authentication.js @@ -23,8 +23,9 @@ function Authenticate($log, $cookieStore, $compile, $window, $scope, $rootScope, loginAgain = function() { Authorization.logout(); setTimeout(function() { + //$location.url('/logout'); window.location = '/#/logout'; // if we get here, force user back to re-login - }, 500); + }, 1000); }; scope.sessionExpired = (Empty($rootScope.sessionExpired)) ? $cookieStore.get('sessionExpired') : $rootScope.sessionExpired; @@ -152,6 +153,7 @@ function Authenticate($log, $cookieStore, $compile, $window, $scope, $rootScope, scope.$emit('AuthorizationGetLicense'); }) .error(function (data, status) { + Authorization.logout(); Wait('stop'); Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', loginAgain); }); diff --git a/awx/ui/static/lib/ansible/AuthService.js b/awx/ui/static/lib/ansible/AuthService.js index d546f71369..8016a61cd5 100644 --- a/awx/ui/static/lib/ansible/AuthService.js +++ b/awx/ui/static/lib/ansible/AuthService.js @@ -58,15 +58,13 @@ angular.module('AuthService', ['ngCookies', 'Utilities']) // should prevent content flash from the prior user. var scope = angular.element(document.getElementById('main-view')).scope(); scope.$destroy(); - $rootScope.$destroy(); + //$rootScope.$destroy(); $cookieStore.remove('token_expires'); $cookieStore.remove('current_user'); $cookieStore.remove('lastPath'); - $cookieStore.remove('lastPath', '/home'); $cookieStore.remove('token'); $cookieStore.put('userLoggedIn', false); $cookieStore.put('sessionExpired', false); - $cookieStore.put('token', ''); $cookieStore.put('current_user', {}); $rootScope.current_user = {}; $rootScope.license_tested = undefined;