mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
AC-301 organization data and related sets now cleared on logout.
This commit is contained in:
parent
b29abf38eb
commit
fa8a697024
@ -15,7 +15,7 @@ function Authenticate($window, $scope, $rootScope, $location, Authorization, Tog
|
||||
// Authorization is injected from AuthService found in services.js
|
||||
|
||||
if ($location.path() == '/logout') {
|
||||
//if logout request, clear AuthToken and user session data
|
||||
//if logout request, clear AuthToken and user session data
|
||||
Authorization.logout();
|
||||
}
|
||||
|
||||
@ -48,11 +48,9 @@ function Authenticate($window, $scope, $rootScope, $location, Authorization, Tog
|
||||
};
|
||||
|
||||
// Call the API to get an auth token
|
||||
$scope.systemLogin = function(username, password) {
|
||||
|
||||
$scope.systemLogin = function(username, password) {
|
||||
$('.api-error').empty();
|
||||
var token;
|
||||
|
||||
Authorization.retrieveToken(username, password)
|
||||
.success( function(data, status, headers, config) {
|
||||
token = data.token;
|
||||
|
||||
@ -5,8 +5,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
angular.module('AuthService', ['ngCookies'])
|
||||
.factory('Authorization', ['$http', '$rootScope', '$location', '$cookieStore', function($http, $rootScope, $location, $cookieStore) {
|
||||
angular.module('AuthService', ['ngCookies', 'OrganizationFormDefinition'])
|
||||
.factory('Authorization', ['$http', '$rootScope', '$location', '$cookieStore', 'OrganizationForm',
|
||||
function($http, $rootScope, $location, $cookieStore, OrganizationForm) {
|
||||
return {
|
||||
setToken: function(token) {
|
||||
// set the session cookie
|
||||
@ -67,23 +68,29 @@ angular.module('AuthService', ['ngCookies'])
|
||||
|
||||
logout: function() {
|
||||
// the following puts our primary scope up for garbage collection, which
|
||||
// should prevent content flash from the prior user.
|
||||
// should prevent content flash from the prior user.
|
||||
var scope = angular.element(document.getElementById('main-view')).scope();
|
||||
scope.$destroy();
|
||||
$rootScope.$destroy();
|
||||
|
||||
// but just in case, clear the organization bits
|
||||
$rootScope.organizations = null;
|
||||
|
||||
$rootScope.current_user = {};
|
||||
$rootScope.license_tested = undefined;
|
||||
// Reset the scope for organizations. No matter what we have tried, nothing seems
|
||||
// to clear the scope fast enough to prevent prior user's content from displaying
|
||||
$rootScope['organizations'] = null;
|
||||
for (var set in OrganizationForm.related) {
|
||||
$rootScope[set] = null;
|
||||
}
|
||||
|
||||
$cookieStore.remove('accordions');
|
||||
$cookieStore.remove('token');
|
||||
$cookieStore.remove('token_expire');
|
||||
$cookieStore.remove('current_user');
|
||||
$rootScope.current_user = {};
|
||||
$rootScope.license_tested = undefined;
|
||||
$rootScope.userLoggedIn = false;
|
||||
$rootScope.token = null;
|
||||
$rootScope.token_expire = new Date(1970, 0, 1, 0, 0, 0, 0);
|
||||
},
|
||||
|
||||
|
||||
getLicense: function() {
|
||||
return $http({
|
||||
method: 'GET',
|
||||
|
||||
@ -133,7 +133,7 @@
|
||||
<li><a href="#jobs" data-toggle="tab">Jobs</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-content" ng-cloak>
|
||||
<div ng-view id="main-view"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user