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-19 11:47:21 +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';
|
|
|
|
import icons from 'components/ui/icons.scss';
|
2016-05-02 12:45:42 +05:30
|
|
|
import { Input, Checkbox } 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';
|
2016-01-19 11:47:21 +05:30
|
|
|
import styles from './password.scss';
|
|
|
|
import messages from './Password.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 = 'PasswordBody';
|
2016-03-28 09:16:51 +05:30
|
|
|
static panelId = 'password';
|
|
|
|
static hasGoBack = true;
|
2016-01-31 18:29:38 +05:30
|
|
|
|
2016-03-28 10:35:18 +05:30
|
|
|
autoFocusField = 'password';
|
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
render() {
|
2016-03-13 14:06:31 +05:30
|
|
|
const {user} = this.context;
|
2016-02-13 20:58:47 +05:30
|
|
|
|
|
|
|
return (
|
2016-01-31 18:29:38 +05:30
|
|
|
<div>
|
2016-02-13 20:58:47 +05:30
|
|
|
{this.renderErrors()}
|
|
|
|
|
2016-01-31 18:29:38 +05:30
|
|
|
<div className={styles.miniProfile}>
|
|
|
|
<div className={styles.avatar}>
|
2016-02-13 20:58:47 +05:30
|
|
|
{user.avatar
|
|
|
|
? <img src={user.avatar} />
|
|
|
|
: <span className={icons.user} />
|
|
|
|
}
|
2016-01-31 18:29:38 +05:30
|
|
|
</div>
|
|
|
|
<div className={styles.email}>
|
2016-02-13 20:58:47 +05:30
|
|
|
{user.email || user.username}
|
2016-01-31 18:29:38 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
2016-02-13 20:58:47 +05:30
|
|
|
<Input {...this.bindField('password')}
|
|
|
|
icon="key"
|
|
|
|
type="password"
|
|
|
|
required
|
|
|
|
placeholder={messages.accountPassword}
|
|
|
|
/>
|
2016-01-31 18:29:38 +05:30
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
<Checkbox {...this.bindField('rememberMe')} label={<Message {...messages.rememberMe} />} />
|
2016-01-31 18:29:38 +05:30
|
|
|
</div>
|
2016-02-13 20:58:47 +05:30
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2016-01-31 18:29:38 +05:30
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
export default function Password() {
|
|
|
|
return {
|
2016-03-28 09:16:51 +05:30
|
|
|
Title: () => ( // TODO: separate component for PageTitle
|
|
|
|
<Message {...messages.passwordTitle}>
|
|
|
|
{(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.signInButton} />
|
|
|
|
</button>
|
|
|
|
),
|
|
|
|
Links: () => (
|
2016-02-28 02:56:13 +05:30
|
|
|
<Link to="/forgot-password">
|
2016-01-31 18:29:38 +05:30
|
|
|
<Message {...messages.forgotPassword} />
|
2016-02-28 02:56:13 +05:30
|
|
|
</Link>
|
2016-01-31 18:29:38 +05:30
|
|
|
)
|
|
|
|
};
|
|
|
|
}
|