From 7902dea5f3b1ae9cba3379fefcaf2e51c5abb265 Mon Sep 17 00:00:00 2001 From: tigerbot Date: Wed, 26 Jul 2017 18:16:30 -0600 Subject: [PATCH] removed useless check for account existence --- js/issuer.js | 51 +++++++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/js/issuer.js b/js/issuer.js index 549b546..31d29bb 100644 --- a/js/issuer.js +++ b/js/issuer.js @@ -84,13 +84,13 @@ $(function () { function getSession(providerUri) { return OAUTH3.hooks.session.get(providerUri).then(function (session) { - if (session && session.access_token) { - normalizeSession(session); - return OAUTH3.PromiseA.resolve(session); - } - else { - return OAUTH3.PromiseA.reject(new Error("no access_token in session")); - } + if (session && session.access_token) { + normalizeSession(session); + return OAUTH3.PromiseA.resolve(session); + } + else { + return OAUTH3.PromiseA.reject(new Error("no access_token in session")); + } }); } @@ -206,34 +206,20 @@ $(function () { // TODO loading email = $('.js-oauth3-email').val(); - return OAUTH3.authn.loginMeta(CONFIG.directives, {email: email, mock: true}).then(function (userResults) { - if (!userResults.data.error) { - console.log('User exists:', userResults); + return OAUTH3.authn.otp(CONFIG.directives, {email: email, mock: true}).then(function (otpResults) { + + if (otpResults.data.error) { + window.alert('otpResults: ' + otpResults.data.error_description || otpResults.data.error.message); + return; } - if (userResults.data.error) { - $('.js-authn-show').removeAttr('disabled'); - console.warn('User does not exist:', email); - console.warn('User Results:', userResults); - //window.alert('userResults: ' + userResults.data.error_description || userResults.data.error.message); - //return; - } + var ua = window.navigator.userAgent; + $('.js-sniffed-device').text(ua); + $('.js-userid-container').removeClass('in').hide(); + $('.js-authn').show().addClass('in'); + $('.js-authn-otp-uuid').val(otpResults.data.uuid); - return OAUTH3.authn.otp(CONFIG.directives, {email: email, mock: true}).then(function (otpResults) { - - if (otpResults.data.error) { - window.alert('otpResults: ' + otpResults.data.error_description || otpResults.data.error.message); - return; - } - - var ua = window.navigator.userAgent; - $('.js-sniffed-device').text(ua); - $('.js-userid-container').removeClass('in').hide(); - $('.js-authn').show().addClass('in'); - $('.js-authn-otp-uuid').val(otpResults.data.uuid); - - $('.js-user-email').text(email); - }); + $('.js-user-email').text(email); }); }; util.rememberDevice = function (ev) { @@ -303,6 +289,7 @@ $(function () { console.error('scope results', err); }); }, function (error) { + console.error(error); $('.error-msg').text('Incorrect code'); }); };