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-02-28 02:56:13 +05:30
|
|
|
import { Link } from 'react-router';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
|
|
|
import buttons from 'components/ui/buttons.scss';
|
2016-01-19 11:47:21 +05:30
|
|
|
import { Input } from 'components/ui/Form';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
2016-03-13 14:20:09 +05:30
|
|
|
import BaseAuthBody from 'components/auth/BaseAuthBody';
|
|
|
|
import passwordMessages from 'components/auth/password/Password.messages';
|
2016-01-19 11:47:21 +05:30
|
|
|
import messages from './Login.messages';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
class Body extends BaseAuthBody {
|
2016-03-13 14:06:31 +05:30
|
|
|
static displayName = 'LoginBody';
|
2016-03-28 09:16:51 +05:30
|
|
|
static panelId = 'login';
|
2016-01-31 18:29:38 +05:30
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{this.renderErrors()}
|
|
|
|
|
|
|
|
<Input {...this.bindField('login')}
|
|
|
|
icon="envelope"
|
|
|
|
autoFocus
|
2016-03-12 19:53:55 +05:30
|
|
|
onFocus={this.fixAutoFocus}
|
2016-02-13 20:58:47 +05:30
|
|
|
required
|
|
|
|
placeholder={messages.emailOrUsername}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Login() {
|
2016-01-31 18:29:38 +05:30
|
|
|
return {
|
|
|
|
Title: () => ( // TODO: separate component for PageTitle
|
|
|
|
<Message {...messages.loginTitle}>
|
|
|
|
{(msg) => <span>{msg}<Helmet title={msg} /></span>}
|
|
|
|
</Message>
|
|
|
|
),
|
2016-02-13 20:58:47 +05:30
|
|
|
Body,
|
|
|
|
Footer: () => (
|
|
|
|
<button className={buttons.green} type="submit">
|
2016-01-31 18:29:38 +05:30
|
|
|
<Message {...messages.next} />
|
|
|
|
</button>
|
|
|
|
),
|
|
|
|
Links: () => (
|
2016-02-28 02:56:13 +05:30
|
|
|
<Link to="/forgot-password">
|
2016-01-31 18:29:38 +05:30
|
|
|
<Message {...passwordMessages.forgotPassword} />
|
2016-02-28 02:56:13 +05:30
|
|
|
</Link>
|
2016-01-31 18:29:38 +05:30
|
|
|
)
|
|
|
|
};
|
|
|
|
}
|