removed useless check for account existence

This commit is contained in:
tigerbot 2017-07-26 18:16:30 -06:00
parent cd1ff73eea
commit 7902dea5f3
1 changed files with 19 additions and 32 deletions

View File

@ -84,13 +84,13 @@ $(function () {
function getSession(providerUri) { function getSession(providerUri) {
return OAUTH3.hooks.session.get(providerUri).then(function (session) { return OAUTH3.hooks.session.get(providerUri).then(function (session) {
if (session && session.access_token) { if (session && session.access_token) {
normalizeSession(session); normalizeSession(session);
return OAUTH3.PromiseA.resolve(session); return OAUTH3.PromiseA.resolve(session);
} }
else { else {
return OAUTH3.PromiseA.reject(new Error("no access_token in session")); return OAUTH3.PromiseA.reject(new Error("no access_token in session"));
} }
}); });
} }
@ -206,34 +206,20 @@ $(function () {
// TODO loading // TODO loading
email = $('.js-oauth3-email').val(); email = $('.js-oauth3-email').val();
return OAUTH3.authn.loginMeta(CONFIG.directives, {email: email, mock: true}).then(function (userResults) { return OAUTH3.authn.otp(CONFIG.directives, {email: email, mock: true}).then(function (otpResults) {
if (!userResults.data.error) {
console.log('User exists:', userResults); if (otpResults.data.error) {
window.alert('otpResults: ' + otpResults.data.error_description || otpResults.data.error.message);
return;
} }
if (userResults.data.error) { var ua = window.navigator.userAgent;
$('.js-authn-show').removeAttr('disabled'); $('.js-sniffed-device').text(ua);
console.warn('User does not exist:', email); $('.js-userid-container').removeClass('in').hide();
console.warn('User Results:', userResults); $('.js-authn').show().addClass('in');
//window.alert('userResults: ' + userResults.data.error_description || userResults.data.error.message); $('.js-authn-otp-uuid').val(otpResults.data.uuid);
//return;
}
return OAUTH3.authn.otp(CONFIG.directives, {email: email, mock: true}).then(function (otpResults) { $('.js-user-email').text(email);
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);
});
}); });
}; };
util.rememberDevice = function (ev) { util.rememberDevice = function (ev) {
@ -303,6 +289,7 @@ $(function () {
console.error('scope results', err); console.error('scope results', err);
}); });
}, function (error) { }, function (error) {
console.error(error);
$('.error-msg').text('Incorrect code'); $('.error-msg').text('Incorrect code');
}); });
}; };