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