Add email submitted view

This commit is contained in:
Hannu Lyytikainen 2017-09-08 15:37:04 +03:00
parent 70fc98d786
commit 5a1c7e5f5a
3 changed files with 87 additions and 2 deletions

View file

@ -0,0 +1,26 @@
@import '../../marketplace.css';
.root {
display: flex;
flex-direction: column;
flex: 1;
justify-content: space-between;
height: 100%;
}
.title {
@apply --marketplaceH1FontStyles;
}
.submittedEmail {
font-weight: bold;
}
.emailSubmittedLink {
@apply --marketplaceH5FontStyles;
color: var(--matterColor);
}
.emailSubmittedLinkHelp {
color: var(--matterColorAnti);
}

View file

@ -2,14 +2,26 @@ import React, { PropTypes } from 'react';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { FormattedMessage } from 'react-intl';
import * as propTypes from '../../util/propTypes';
import { sendVerificationEmail } from '../../ducks/user.duck';
import { logout, authenticationInProgress } from '../../ducks/Auth.duck';
import { manageDisableScrolling, isScrollingDisabled } from '../../ducks/UI.duck';
import { recoverPassword } from './PasswordRecoveryPage.duck';
import { PageLayout, Topbar } from '../../components';
import { PageLayout, Topbar, NamedLink } from '../../components';
import { PasswordRecoveryForm } from '../../containers';
import css from './PasswordRecoveryPage.css';
const recoveryMessage = submittedEmail => {
if (submittedEmail) {
const email = <span className={css.submittedEmail}>{submittedEmail}</span>;
return <FormattedMessage id="PasswordRecoveryPage.emailSubmittedMessage" values={{ email }} />;
} else {
return <FormattedMessage id="PasswordRecoveryPage.forgotPasswordMessage" />;
}
};
export const PasswordRecoveryPageComponent = props => {
const {
authInfoError,
@ -34,6 +46,38 @@ export const PasswordRecoveryPageComponent = props => {
onSubmitEmail,
} = props;
const title = submittedEmail
? <FormattedMessage id="PasswordRecoveryPage.emailSubmittedTitle" />
: <FormattedMessage id="PasswordRecoveryPage.forgotPasswordTitle" />;
const message = recoveryMessage(submittedEmail);
const sendAnotherHelp = (
<span className={css.emailSubmittedLinkHelp}>
<FormattedMessage id="PasswordRecoveryPage.sendAnotherHelp" />
</span>
);
const fixEmailHelp = (
<span className={css.emailSubmittedLinkHelp}>
<FormattedMessage id="PasswordRecoveryPage.fixEmailHelp" />
</span>
);
const emailSubmittedLinks = (
<div>
<p>
<NamedLink className={css.emailSubmittedLink} name="PasswordRecoveryPage">
<FormattedMessage id="PasswordRecoveryPage.sendAnother" values={{ sendAnotherHelp }} />
</NamedLink>
</p>
<p>
<NamedLink className={css.emailSubmittedLink} name="PasswordRecoveryPage">
<FormattedMessage id="PasswordRecoveryPage.fixEmail" values={{ fixEmailHelp }} />
</NamedLink>
</p>
</div>
);
return (
<PageLayout
authInfoError={authInfoError}
@ -55,7 +99,14 @@ export const PasswordRecoveryPageComponent = props => {
sendVerificationEmailInProgress={sendVerificationEmailInProgress}
sendVerificationEmailError={sendVerificationEmailError}
/>
<PasswordRecoveryForm onSubmit={values => onSubmitEmail(values.email)} />
<div>
<h1 className={css.title}>{title}</h1>
<p>{message}</p>
{submittedEmail
? emailSubmittedLinks
: <PasswordRecoveryForm onSubmit={values => onSubmitEmail(values.email)} />}
</div>
</PageLayout>
);
};

View file

@ -231,6 +231,14 @@
"PasswordRecoveryForm.goToLogin": "Go to log in.",
"PasswordRecoveryForm.goToLoginHelp": "Don't need the password recovery?",
"PasswordRecoveryForm.sendInstructions": "Send instructions",
"PasswordRecoveryPage.emailSubmittedTitle": "Check your inbox",
"PasswordRecoveryPage.emailSubmittedMessage": "We have sent the instructions for resetting your password to {email}.",
"PasswordRecoveryPage.fixEmail": "{fixEmailHelp} Fix it.",
"PasswordRecoveryPage.fixEmailHelp": "Whoops, typo in your email?",
"PasswordRecoveryPage.forgotPasswordTitle": "Forgot your password?",
"PasswordRecoveryPage.forgotPasswordMessage": "No worries! Please enter the email address you used when signing up and we'll send you instructions on how to create a new password.",
"PasswordRecoveryPage.sendAnother": "{sendAnotherHelp} Send another email.",
"PasswordRecoveryPage.sendAnotherHelp": "Didn't get the email?",
"PayoutDetailsForm.addressTitle": "Address",
"PayoutDetailsForm.bankDetails": "Bank details",
"PayoutDetailsForm.birthdayDatePlaceholder": "dd",