From cc62a4eec10845cc0b31da7d0f27287cfa7c4866 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 23 Apr 2020 14:14:43 -0400 Subject: [PATCH] allow users to signin after they abandoned a previous signup --- dist/bundle.es.js | 10 ++++++++-- dist/bundle.js | 10 ++++++++-- src/redux/actions/user.js | 11 +++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 7e5676e..a8d36f3 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1570,7 +1570,7 @@ function doUserCheckIfEmailExists(email) { email }); - const success = response => { + const triggerEmailFlow = hasPassword => { dispatch({ type: USER_EMAIL_NEW_SUCCESS, data: { @@ -1581,7 +1581,7 @@ function doUserCheckIfEmailExists(email) { type: USER_EMAIL_NEW_EXISTS }); - if (response.has_password) { + if (hasPassword) { dispatch({ type: USER_PASSWORD_EXISTS }); @@ -1594,6 +1594,10 @@ function doUserCheckIfEmailExists(email) { } }; + const success = response => { + triggerEmailFlow(response.has_password); + }; + const failure = error => dispatch({ type: USER_EMAIL_NEW_FAILURE, data: { @@ -1608,6 +1612,8 @@ function doUserCheckIfEmailExists(email) { dispatch({ type: USER_EMAIL_NEW_DOES_NOT_EXIST }); + } else if (error.response && error.response.status === 412) { + triggerEmailFlow(false); } throw error; diff --git a/dist/bundle.js b/dist/bundle.js index 734870c..0eea202 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -5288,7 +5288,7 @@ function doUserCheckIfEmailExists(email) { email: email }); - var success = function success(response) { + var triggerEmailFlow = function triggerEmailFlow(hasPassword) { dispatch({ type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_SUCCESS"], data: { @@ -5299,7 +5299,7 @@ function doUserCheckIfEmailExists(email) { type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_EXISTS"] }); - if (response.has_password) { + if (hasPassword) { dispatch({ type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_PASSWORD_EXISTS"] }); @@ -5312,6 +5312,10 @@ function doUserCheckIfEmailExists(email) { } }; + var success = function success(response) { + triggerEmailFlow(response.has_password); + }; + var failure = function failure(error) { return dispatch({ type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_FAILURE"], @@ -5328,6 +5332,8 @@ function doUserCheckIfEmailExists(email) { dispatch({ type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_DOES_NOT_EXIST"] }); + } else if (error.response && error.response.status === 412) { + triggerEmailFlow(false); } throw error; diff --git a/src/redux/actions/user.js b/src/redux/actions/user.js index fda8762..72aa3b5 100644 --- a/src/redux/actions/user.js +++ b/src/redux/actions/user.js @@ -312,7 +312,7 @@ export function doUserCheckIfEmailExists(email) { email, }); - const success = response => { + const triggerEmailFlow = hasPassword => { dispatch({ type: ACTIONS.USER_EMAIL_NEW_SUCCESS, data: { email }, @@ -322,7 +322,7 @@ export function doUserCheckIfEmailExists(email) { type: ACTIONS.USER_EMAIL_NEW_EXISTS, }); - if (response.has_password) { + if (hasPassword) { dispatch({ type: ACTIONS.USER_PASSWORD_EXISTS, }); @@ -332,6 +332,10 @@ export function doUserCheckIfEmailExists(email) { } }; + const success = response => { + triggerEmailFlow(response.has_password); + }; + const failure = error => dispatch({ type: ACTIONS.USER_EMAIL_NEW_FAILURE, @@ -344,7 +348,10 @@ export function doUserCheckIfEmailExists(email) { dispatch({ type: ACTIONS.USER_EMAIL_NEW_DOES_NOT_EXIST, }); + } else if (error.response && error.response.status === 412) { + triggerEmailFlow(false); } + throw error; }) .then(success, failure);