SecurityForm: Break ChangeEmailForm into separate component

This commit is contained in:
Alex Gleason 2020-06-05 15:03:21 -05:00
parent f99d1300c2
commit e972cfc191
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -20,10 +20,25 @@ const messages = defineMessages({
updateEmailFail: { id: 'security.update_email.fail', defaultMessage: 'Update email failed.' },
});
export default @connect()
@injectIntl
export default @injectIntl
class SecurityForm extends ImmutablePureComponent {
render() {
const { intl } = this.props;
return (
<Column icon='lock' heading={intl.formatMessage(messages.heading)} backBtnSlim>
<ChangeEmailForm />
</Column>
);
}
}
@connect()
@injectIntl
class ChangeEmailForm extends ImmutablePureComponent {
static propTypes = {
email: PropTypes.string,
dispatch: PropTypes.func.isRequired,
@ -59,33 +74,31 @@ class SecurityForm extends ImmutablePureComponent {
const { intl } = this.props;
return (
<Column icon='lock' heading={intl.formatMessage(messages.heading)} backBtnSlim>
<SimpleForm onSubmit={this.handleSubmit}>
<fieldset disabled={this.state.isLoading}>
<FieldsGroup>
<TextInput
label='Email address'
placeholder='me@example.com'
name='email'
onChange={this.handleInputChange}
value={this.state.email}
/>
<SimpleInput
type='password'
label='Password'
name='password'
onChange={this.handleInputChange}
value={this.state.password}
/>
<div className='actions'>
<button name='button' type='submit' className='btn button button-primary'>
{intl.formatMessage(messages.submit)}
</button>
</div>
</FieldsGroup>
</fieldset>
</SimpleForm>
</Column>
<SimpleForm onSubmit={this.handleSubmit}>
<fieldset disabled={this.state.isLoading}>
<FieldsGroup>
<TextInput
label='Email address'
placeholder='me@example.com'
name='email'
onChange={this.handleInputChange}
value={this.state.email}
/>
<SimpleInput
type='password'
label='Password'
name='password'
onChange={this.handleInputChange}
value={this.state.password}
/>
<div className='actions'>
<button name='button' type='submit' className='btn button button-primary'>
{intl.formatMessage(messages.submit)}
</button>
</div>
</FieldsGroup>
</fieldset>
</SimpleForm>
);
}