This commit is contained in:
Jon Lambson 2017-08-28 11:05:42 -06:00
parent c01fb9d53f
commit 5e1f9f9179
2 changed files with 12 additions and 2 deletions

View File

@ -117,21 +117,26 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
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)
$state.go("app." + $rootScope.redirectedURL);
console.log('da ');
}
console.log('WHERE', $rootScope.redirectedURL );
$state.go('splash-page', { 'toState': toState.name });

View File

@ -102,6 +102,11 @@ app.controller('loginCtrl', [
subject: subject
, scope: [ 'domains@oauth3.org', 'domains', 'dns@oauth3.org', 'dns', 'www@daplie.com' ]
}).then(function (session) {
console.log('SESSION BRO -> ', session);
console.log('SESSION TOKEN -> ', session.token);
console.log('SESSION REFRESH TOKEN -> ', session.refresh);
console.log('SESSION ISSUER -> ', session.token.iss);
console.log('SESSION AUDIENCE -> ', session.token.aud);
session.subject = subject;
session.issuer = issuer;
Auth.add(session);