diff --git a/index.html b/index.html index 51da29c..958781f 100644 --- a/index.html +++ b/index.html @@ -71,8 +71,7 @@ - - + @@ -146,11 +145,11 @@ + + + - - - diff --git a/js/issuer.js b/js/issuer.js index 31d29bb..f7f8f7b 100644 --- a/js/issuer.js +++ b/js/issuer.js @@ -20,16 +20,6 @@ $(function () { }; $('.js-scopes-container').html(''); - OAUTH3._hooks = { sessions: {} }; - OAUTH3._hooks.sessions.get = function (providerUri, id) { - return JSON.parse(window.localStorage.getItem('session-' + providerUri + (id || '')) || 'null'); - }; - OAUTH3._hooks.sessions.set = function (providerUri, newSession, id) { - window.localStorage.setItem('session-' + providerUri, JSON.stringify(newSession)); - window.localStorage.setItem('session-' + providerUri + (id || newSession.id || newSession.token.id || ''), JSON.stringify(newSession)); - return newSession; - }; - // TODO let query.parse do location.hash || location.search || location var clientParams = OAUTH3.query.parse(loc.hash || loc.search); if (/authorization_dialog/.test(window.location.href)) { @@ -222,26 +212,11 @@ $(function () { $('.js-user-email').text(email); }); }; - util.rememberDevice = function (ev) { - ev.preventDefault(); - ev.stopPropagation(); - - util.submitLoginCode({ - rememberDevice: true - }); - }; - util.rememberDeviceNot = function (ev) { - ev.preventDefault(); - ev.stopPropagation(); - - util.submitLoginCode({ - rememberDevice: false - }); - }; // Reference Implementation - - util.submitLoginCode = function (opts) { + util.submitLoginCode = function (ev) { + ev.preventDefault(); + ev.stopPropagation(); // TODO // perhaps we should check that the code is valid before continuing to login (so that we don't send the key) @@ -249,7 +224,6 @@ $(function () { // TODO // we should be sending the public key for this device as a jwk along with the authentication // (and how long to remember this device) - var uuid = $('.js-authn-otp-uuid').val(); var code = $('.js-authn-otp-code').val().trim(); return OAUTH3.authn.resourceOwnerPassword(CONFIG.directives, { @@ -263,7 +237,7 @@ $(function () { // TODO should be otp_id (agnostic of uuid) , otp_uuid: uuid // add expiration to the refresh token and/or public key - , expire: opts.rememberDevice || (1 * 60 * 60 * 1000) + , remember_device: $('.js-remember-label').find('.js-remember-checkbox').prop('checked') , mock: true }).then(function (session) { $('.js-authn').removeClass('in').hide(); @@ -344,7 +318,6 @@ $(function () { util.editEmail = function () { $('.js-authn').hide(); $('.js-userid-container').show(); - debugger; }; @@ -359,8 +332,7 @@ $(function () { $('body').on('click', '.js-logout', util.handleLogout); $('body').on('click', '.js-authn-show', util.submitAuthEmail); - $('body').on('click', '.js-authz-remember-me', util.rememberDevice); - $('body').on('click', '.js-authz-remember-me-not', util.rememberDeviceNot); + $('body').on('click', '.js-submit-code-btn', util.submitLoginCode); $('body').on('click', '.js-login-allow', util.acceptScopesAndLogin); $('body').on('click', '.js-login-deny', util.closeLoginDeny); $('body').on('click', '.js-edit-email-button', util.editEmail);