almost
This commit is contained in:
parent
b70aee0abb
commit
69a6783e44
27
js/app.js
27
js/app.js
|
@ -117,25 +117,26 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat
|
||||||
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
|
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
|
||||||
var requiresLogin = toState.data.requiresLogin;
|
var requiresLogin = toState.data.requiresLogin;
|
||||||
toState.data.session = $location.search();
|
toState.data.session = $location.search();
|
||||||
var urlParams = $location.search();
|
|
||||||
$rootScope.redirectedURL = toState.url;
|
$rootScope.redirectedURL = toState.url;
|
||||||
|
var query = $location.search();
|
||||||
$rootScope.urlArray.push($rootScope.redirectedURL);
|
$rootScope.urlArray.push($rootScope.redirectedURL);
|
||||||
if ($rootScope.urlArray.length > 1) {
|
// if ($rootScope.urlArray.length > 1) {
|
||||||
$rootScope.redirectedURL = $rootScope.urlArray[0];
|
// $rootScope.redirectedURL = $rootScope.urlArray[0];
|
||||||
$rootScope.urlArray = [];
|
// $rootScope.urlArray = [];
|
||||||
}
|
// }
|
||||||
if (requiresLogin && !Auth.isLoggedIn()) {
|
if (requiresLogin && !Auth.isLoggedIn()) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
console.log('stuff here ->', toState);
|
toState.data.session.token = OAUTH3.jwt.decode(query.access_token);
|
||||||
|
toState.data.session.refresh = OAUTH3.jwt.decode(query.refresh_token);
|
||||||
if (!angular.equals(toState.data.session, {})) {
|
if (!angular.equals(toState.data.session, {})) {
|
||||||
if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) {
|
// if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) {
|
||||||
Auth.add(urlParams);
|
Auth.add(query);
|
||||||
console.log('CURRENT SESSION IS: ',Auth.sessions);
|
console.log('go here', $rootScope.redirectedURL);
|
||||||
}
|
$state.go('app.'+$rootScope.redirectedURL)
|
||||||
|
// $location.path($rootScope.redirectedURL);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
// $state.go('splash-page', { 'toState': toState.name });
|
||||||
console.log('WHERE', $rootScope.redirectedURL );
|
|
||||||
$state.go('splash-page', { 'toState': toState.name });
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -102,11 +102,6 @@ app.controller('loginCtrl', [
|
||||||
subject: subject
|
subject: subject
|
||||||
, scope: [ 'domains@oauth3.org', 'domains', 'dns@oauth3.org', 'dns', 'www@daplie.com' ]
|
, scope: [ 'domains@oauth3.org', 'domains', 'dns@oauth3.org', 'dns', 'www@daplie.com' ]
|
||||||
}).then(function (session) {
|
}).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.subject = subject;
|
||||||
session.issuer = issuer;
|
session.issuer = issuer;
|
||||||
Auth.add(session);
|
Auth.add(session);
|
||||||
|
|
|
@ -22,7 +22,6 @@ app.factory('Auth', [
|
||||||
return Auth.sessions || false;
|
return Auth.sessions || false;
|
||||||
}
|
}
|
||||||
, add: function (session) {
|
, add: function (session) {
|
||||||
console.log('what ya adding');
|
|
||||||
console.log(session);
|
console.log(session);
|
||||||
var obj = JSON.parse(localStorage.getItem(dapSessions) || 'null') || {};
|
var obj = JSON.parse(localStorage.getItem(dapSessions) || 'null') || {};
|
||||||
var dapName = 'dap-' + session.subject + '|' + session.issuer;
|
var dapName = 'dap-' + session.subject + '|' + session.issuer;
|
||||||
|
@ -71,8 +70,6 @@ app.factory('Auth', [
|
||||||
return Auth.session;
|
return Auth.session;
|
||||||
}
|
}
|
||||||
, get: function (session) {
|
, get: function (session) {
|
||||||
console.log('session:::::::');
|
|
||||||
console.log(session);
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
return $q.resolve(null);
|
return $q.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue