diff --git a/client/coral-framework/actions/auth.js b/client/coral-framework/actions/auth.js index bf7984579..592fe2be1 100644 --- a/client/coral-framework/actions/auth.js +++ b/client/coral-framework/actions/auth.js @@ -156,7 +156,7 @@ const confirmEmailFailure = () => ({type: actions.CONFIRM_EMAIL_FAILURE}); export const requestConfirmEmail = email => dispatch => { dispatch(confirmEmailRequest()); - coralApi('/users/resend-confirm', {method: 'POST', body: {email}}) + return coralApi('/users/resend-confirm', {method: 'POST', body: {email}}) .then(() => { dispatch(confirmEmailSuccess()); }) diff --git a/client/coral-framework/reducers/auth.js b/client/coral-framework/reducers/auth.js index 54ffa37a6..6cb4e97cd 100644 --- a/client/coral-framework/reducers/auth.js +++ b/client/coral-framework/reducers/auth.js @@ -12,6 +12,8 @@ const initialState = Map({ passwordRequestSuccess: null, passwordRequestFailure: null, emailConfirmationFailure: false, + emailConfirmationLoading: false, + emailConfirmationSuccess: false, successSignUp: false }); @@ -35,6 +37,8 @@ export default function auth (state = initialState, action) { passwordRequestFailure: null, passwordRequestSuccess: null, emailConfirmationFailure: false, + emailConfirmationSuccess: false, + emailConfirmationLoading: false, successSignUp: false })); case actions.CHANGE_VIEW : @@ -104,7 +108,15 @@ export default function auth (state = initialState, action) { .set('passwordRequestFailure', 'There was an error sending your password reset email. Please try again soon!') .set('passwordRequestSuccess', null); case actions.EMAIL_CONFIRM_ERROR: - return state.set('emailConfirmationFailure', true); + return state + .set('emailConfirmationFailure', true) + .set('emailConfirmationLoading', false); + case actions.CONFIRM_EMAIL_REQUEST: + return state.set('emailConfirmationLoading', true); + case actions.CONFIRM_EMAIL_SUCCESS: + return state + .set('emailConfirmationSuccess', true) + .set('emailConfirmationLoading', false); default : return state; } diff --git a/client/coral-sign-in/components/SignDialog.js b/client/coral-sign-in/components/SignDialog.js index 6243472b4..0645f110f 100644 --- a/client/coral-sign-in/components/SignDialog.js +++ b/client/coral-sign-in/components/SignDialog.js @@ -17,7 +17,12 @@ const SignDialog = ({open, view, handleClose, offset, ...props}) => ( }}> × {view === 'SIGNIN' && } - {view === 'SIGNUP' && } + { + view === 'SIGNUP' && + } {view === 'FORGOT' && } ); diff --git a/client/coral-sign-in/components/SignInContent.js b/client/coral-sign-in/components/SignInContent.js index d3d064c06..e27185b52 100644 --- a/client/coral-sign-in/components/SignInContent.js +++ b/client/coral-sign-in/components/SignInContent.js @@ -1,6 +1,6 @@ import React, {PropTypes} from 'react'; import Alert from './Alert'; -import {Button, FormField, Spinner} from 'coral-ui'; +import {Button, FormField, Spinner, Success} from 'coral-ui'; import styles from './styles.css'; import I18n from 'coral-framework/modules/i18n/i18n'; import translations from '../translations'; @@ -11,6 +11,8 @@ const SignInContent = ({ handleChangeEmail, emailToBeResent, handleResendConfirmation, + emailConfirmationLoading, + emailConfirmationSuccess, formData, ...props }) => { @@ -44,6 +46,8 @@ const SignInContent = ({ value={emailToBeResent} onChange={handleChangeEmail} /> + {emailConfirmationLoading && } + {emailConfirmationSuccess && } :
{ + setTimeout(() => { + + // allow success UI to be shown for a second, and then close the modal + this.props.handleClose(); + }, 2500); + }); } addError(name, error) { @@ -139,12 +144,9 @@ class SignInContainer extends Component { this.props.fetchSignIn(this.state.formData); } - handleClose() { - this.props.hideSignInDialog(); - } - render() { const {auth, showSignInDialog, noButton, offset} = this.props; + const {emailConfirmationLoading, emailConfirmationSuccess} = auth; return (
{!noButton &&