AC-301 organization data and related sets now cleared on logout.

This commit is contained in:
chouseknecht
2013-07-30 00:48:06 -04:00
parent b29abf38eb
commit fa8a697024
3 changed files with 19 additions and 14 deletions

View File

@@ -49,10 +49,8 @@ function Authenticate($window, $scope, $rootScope, $location, Authorization, Tog
// Call the API to get an auth token
$scope.systemLogin = function(username, password) {
$('.api-error').empty();
var token;
Authorization.retrieveToken(username, password)
.success( function(data, status, headers, config) {
token = data.token;

View File

@@ -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,18 +68,24 @@ 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;
// 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;
}
$rootScope.current_user = {};
$rootScope.license_tested = undefined;
$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);

View File

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