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