2016-03-13 14:06:31 +05:30
|
|
|
import React from 'react';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
|
|
|
import { FormattedMessage as Message } from 'react-intl';
|
2016-01-16 18:05:12 +05:30
|
|
|
import Helmet from 'react-helmet';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
|
|
|
import buttons from 'components/ui/buttons.scss';
|
|
|
|
import { Input, Checkbox } from 'components/ui/Form';
|
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
import BaseAuthBody from './BaseAuthBody';
|
2016-01-19 11:47:21 +05:30
|
|
|
import messages from './Register.messages';
|
|
|
|
import activationMessages from './Activation.messages';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
// TODO: password and username can be validate for length and sameness
|
|
|
|
|
|
|
|
class Body extends BaseAuthBody {
|
2016-03-13 14:06:31 +05:30
|
|
|
static displayName = 'RegisterBody';
|
2016-02-13 20:58:47 +05:30
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{this.renderErrors()}
|
|
|
|
|
|
|
|
<Input {...this.bindField('username')}
|
|
|
|
icon="user"
|
|
|
|
color="blue"
|
|
|
|
type="text"
|
|
|
|
autoFocus
|
2016-03-12 19:53:55 +05:30
|
|
|
onFocus={this.fixAutoFocus}
|
2016-02-13 20:58:47 +05:30
|
|
|
required
|
|
|
|
placeholder={messages.yourNickname}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Input {...this.bindField('email')}
|
|
|
|
icon="envelope"
|
|
|
|
color="blue"
|
|
|
|
type="email"
|
|
|
|
required
|
|
|
|
placeholder={messages.yourEmail}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Input {...this.bindField('password')}
|
|
|
|
icon="key"
|
|
|
|
color="blue"
|
|
|
|
type="password"
|
|
|
|
required
|
|
|
|
placeholder={messages.accountPassword}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Input {...this.bindField('rePassword')}
|
|
|
|
icon="key"
|
|
|
|
color="blue"
|
|
|
|
type="password"
|
|
|
|
required
|
|
|
|
placeholder={messages.repeatPassword}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Checkbox {...this.bindField('rulesAgreement')}
|
|
|
|
color="blue"
|
|
|
|
required
|
|
|
|
label={
|
|
|
|
<Message {...messages.acceptRules} values={{
|
|
|
|
link: (
|
|
|
|
<a href="#">
|
|
|
|
<Message {...messages.termsOfService} />
|
|
|
|
</a>
|
|
|
|
)
|
|
|
|
}} />
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-31 18:29:38 +05:30
|
|
|
export default function Register() {
|
|
|
|
return {
|
|
|
|
Title: () => ( // TODO: separate component for PageTitle
|
|
|
|
<Message {...messages.registerTitle}>
|
|
|
|
{(msg) => <span>{msg}<Helmet title={msg} /></span>}
|
|
|
|
</Message>
|
|
|
|
),
|
2016-02-13 20:58:47 +05:30
|
|
|
Body,
|
|
|
|
Footer: () => (
|
|
|
|
<button className={buttons.blue} type="submit">
|
2016-01-31 18:29:38 +05:30
|
|
|
<Message {...messages.signUpButton} />
|
|
|
|
</button>
|
|
|
|
),
|
|
|
|
Links: () => (
|
|
|
|
<a href="#">
|
|
|
|
<Message {...activationMessages.didNotReceivedEmail} />
|
|
|
|
</a>
|
|
|
|
)
|
|
|
|
};
|
|
|
|
}
|