mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 20:53:24 +10:00
Enable submit button with initial email
This commit is contained in:
parent
4d7887f887
commit
484ce61fa7
2 changed files with 5 additions and 6 deletions
|
|
@ -8,7 +8,7 @@ import * as validators from '../../util/validators';
|
|||
import css from './PasswordRecoveryForm.css';
|
||||
|
||||
const PasswordRecoveryFormComponent = props => {
|
||||
const { handleSubmit, pristine, submitting, form, intl } = props;
|
||||
const { handleSubmit, pristine, submitting, form, initialValues, intl } = props;
|
||||
|
||||
// email
|
||||
const emailLabel = intl.formatMessage({
|
||||
|
|
@ -21,6 +21,8 @@ const PasswordRecoveryFormComponent = props => {
|
|||
id: 'PasswordRecoveryForm.emailRequired',
|
||||
});
|
||||
const emailRequired = validators.required(emailRequiredMessage);
|
||||
const initialEmail = initialValues ? initialValues.email : null;
|
||||
const buttonDisabled = (pristine && !initialEmail) || submitting;
|
||||
return (
|
||||
<form onSubmit={handleSubmit}>
|
||||
<TextInputField
|
||||
|
|
@ -41,7 +43,7 @@ const PasswordRecoveryFormComponent = props => {
|
|||
<FormattedMessage id="PasswordRecoveryForm.goToLogin" />
|
||||
</NamedLink>
|
||||
</p>
|
||||
<PrimaryButton type="submit" disabled={pristine || submitting}>
|
||||
<PrimaryButton type="submit" disabled={buttonDisabled}>
|
||||
<FormattedMessage id="PasswordRecoveryForm.sendInstructions" />
|
||||
</PrimaryButton>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -73,10 +73,7 @@ export const PasswordRecoveryPageComponent = props => {
|
|||
</p>
|
||||
<p>
|
||||
|
||||
<InlineTextButton
|
||||
className={css.emailSubmittedLink}
|
||||
onClick={onRetypeEmail}
|
||||
>
|
||||
<InlineTextButton className={css.emailSubmittedLink} onClick={onRetypeEmail}>
|
||||
<FormattedMessage id="PasswordRecoveryPage.fixEmail" values={{ fixEmailHelp }} />
|
||||
</InlineTextButton>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue