mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
AC-301 organization data and related sets now cleared on logout.
This commit is contained in:
@@ -49,10 +49,8 @@ function Authenticate($window, $scope, $rootScope, $location, Authorization, Tog
|
|||||||
|
|
||||||
// Call the API to get an auth token
|
// Call the API to get an auth token
|
||||||
$scope.systemLogin = function(username, password) {
|
$scope.systemLogin = function(username, password) {
|
||||||
|
|
||||||
$('.api-error').empty();
|
$('.api-error').empty();
|
||||||
var token;
|
var token;
|
||||||
|
|
||||||
Authorization.retrieveToken(username, password)
|
Authorization.retrieveToken(username, password)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
token = data.token;
|
token = data.token;
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
angular.module('AuthService', ['ngCookies'])
|
angular.module('AuthService', ['ngCookies', 'OrganizationFormDefinition'])
|
||||||
.factory('Authorization', ['$http', '$rootScope', '$location', '$cookieStore', function($http, $rootScope, $location, $cookieStore) {
|
.factory('Authorization', ['$http', '$rootScope', '$location', '$cookieStore', 'OrganizationForm',
|
||||||
|
function($http, $rootScope, $location, $cookieStore, OrganizationForm) {
|
||||||
return {
|
return {
|
||||||
setToken: function(token) {
|
setToken: function(token) {
|
||||||
// set the session cookie
|
// set the session cookie
|
||||||
@@ -67,18 +68,24 @@ angular.module('AuthService', ['ngCookies'])
|
|||||||
|
|
||||||
logout: function() {
|
logout: function() {
|
||||||
// the following puts our primary scope up for garbage collection, which
|
// 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();
|
var scope = angular.element(document.getElementById('main-view')).scope();
|
||||||
scope.$destroy();
|
scope.$destroy();
|
||||||
|
$rootScope.$destroy();
|
||||||
|
|
||||||
// but just in case, clear the organization bits
|
// Reset the scope for organizations. No matter what we have tried, nothing seems
|
||||||
$rootScope.organizations = null;
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
$rootScope.current_user = {};
|
$cookieStore.remove('accordions');
|
||||||
$rootScope.license_tested = undefined;
|
|
||||||
$cookieStore.remove('token');
|
$cookieStore.remove('token');
|
||||||
$cookieStore.remove('token_expire');
|
$cookieStore.remove('token_expire');
|
||||||
$cookieStore.remove('current_user');
|
$cookieStore.remove('current_user');
|
||||||
|
$rootScope.current_user = {};
|
||||||
|
$rootScope.license_tested = undefined;
|
||||||
$rootScope.userLoggedIn = false;
|
$rootScope.userLoggedIn = false;
|
||||||
$rootScope.token = null;
|
$rootScope.token = null;
|
||||||
$rootScope.token_expire = new Date(1970, 0, 1, 0, 0, 0, 0);
|
$rootScope.token_expire = new Date(1970, 0, 1, 0, 0, 0, 0);
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
<li><a href="#jobs" data-toggle="tab">Jobs</a></li>
|
<li><a href="#jobs" data-toggle="tab">Jobs</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content" ng-cloak>
|
||||||
<div ng-view id="main-view"></div>
|
<div ng-view id="main-view"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user