handled case of un-refreshable saved session
This commit is contained in:
parent
ea788bcb76
commit
cd1ff73eea
24
js/issuer.js
24
js/issuer.js
|
@ -171,9 +171,6 @@ $(function () {
|
|||
});
|
||||
|
||||
$('.js-authz').show().addClass('in');
|
||||
}, function (err) {
|
||||
window.alert('grantResults: ' + err.message);
|
||||
console.error('scope results', err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -283,10 +280,7 @@ $(function () {
|
|||
, expire: opts.rememberDevice || (1 * 60 * 60 * 1000)
|
||||
, mock: true
|
||||
}).then(function (session) {
|
||||
|
||||
$('.js-authn').removeClass('in').hide();
|
||||
|
||||
function getAccount(session) {
|
||||
if (session.token.sub) {
|
||||
return OAUTH3.PromiseA.resolve(session);
|
||||
}
|
||||
|
@ -303,15 +297,14 @@ $(function () {
|
|||
, refresh_token: (results.refresh_token || results.refreshToken)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return getAccount(session).then(function () {
|
||||
return getGrants(session);
|
||||
}).then(function (session) {
|
||||
return getGrants(session).catch(function (err) {
|
||||
window.alert('grantResults: ' + err.message);
|
||||
console.error('scope results', err);
|
||||
});
|
||||
}, function (error) {
|
||||
$('.error-msg').text('Incorrect code');
|
||||
});
|
||||
|
||||
};
|
||||
util.acceptScopesAndLogin = function (ev) {
|
||||
ev.preventDefault();
|
||||
|
@ -371,6 +364,8 @@ $(function () {
|
|||
//
|
||||
// Page Setup
|
||||
//
|
||||
$('.js-authorization-dialog').hide();
|
||||
$('.js-logout-container').hide();
|
||||
$('.js-userid-container').hide();
|
||||
$('.js-authn').hide();
|
||||
$('.js-authz').hide();
|
||||
|
@ -387,7 +382,7 @@ $(function () {
|
|||
function handleAuthorizationDialog() {
|
||||
return getSession(CONFIG.host).then(function (session) {
|
||||
return getGrants(session);
|
||||
}, function (e) {
|
||||
}).catch(function () {
|
||||
// TODO select the providers the client wants to show
|
||||
// providers=daplie.com,facebook.com,google.com // etc
|
||||
// TODO let the client specify switch_user
|
||||
|
@ -405,8 +400,6 @@ $(function () {
|
|||
$('.js-authn-show').prop('disabled', false);
|
||||
}
|
||||
$('.js-userid-container').show();
|
||||
}).then(function () {
|
||||
//$('body').addClass('in');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -416,9 +409,6 @@ $(function () {
|
|||
CONFIG.directives = directives;
|
||||
directives.issuer = directives.issuer || (window.location.host + window.location.pathname).replace(/\/$/, '');
|
||||
|
||||
$('.js-authorization-dialog').hide();
|
||||
$('.js-logout-container').hide();
|
||||
|
||||
if (/authorization_dialog/.test(window.location.href)) {
|
||||
$('.js-authorization-dialog').show();
|
||||
handleAuthorizationDialog();
|
||||
|
|
Loading…
Reference in New Issue