This commit is contained in:
Jon Lambson 2017-08-28 12:56:53 -06:00
parent 5e1f9f9179
commit c12c644188
2 changed files with 10 additions and 10 deletions

View File

@ -118,28 +118,24 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat
var requiresLogin = toState.data.requiresLogin;
toState.data.session = $location.search();
var urlParams = $location.search();
console.log('DUDDDDDDDEEEEEE ->', urlParams);
$rootScope.redirectedURL = toState.url;
$rootScope.urlArray.push($rootScope.redirectedURL);
if ($rootScope.urlArray.length > 1) {
$rootScope.redirectedURL = $rootScope.urlArray[0];
$rootScope.urlArray = [];
}
console.log('stuff here ->', toState);
if (requiresLogin && !Auth.isLoggedIn()) {
event.preventDefault();
console.log('stuff here ->', toState);
if (!angular.equals(toState.data.session, {})) {
var sess = toState.data.session.access_token;
console.log('WHERE', $rootScope.redirectedURL );
// $state.go("app." + $rootScope.redirectedURL);
}
if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) {
Auth.add(sess)
console.log('da ');
Auth.add(urlParams)
console.log('CURRENT SESSION IS: ',Auth.sessions);
}
}
console.log('WHERE', $rootScope.redirectedURL );
$state.go('splash-page', { 'toState': toState.name });
// $state.go('splash-page', { 'toState': toState.name });
}
});
}]);

View File

@ -22,6 +22,7 @@ app.factory('Auth', [
return Auth.sessions || false;
}
, add: function (session) {
console.log(session);
var obj = JSON.parse(localStorage.getItem(dapSessions) || 'null') || {};
var dapName = 'dap-' + session.subject + '|' + session.issuer;
@ -69,6 +70,8 @@ app.factory('Auth', [
return Auth.session;
}
, get: function (session) {
console.log('mother fucking');
console.log(session);
if (!session) {
return $q.resolve(null);
}
@ -78,6 +81,7 @@ app.factory('Auth', [
}
var name = session.token.sub + '@' + session.token.iss;
console.log('NAME', name);
var promise;
var sess;