2016-03-13 10:36:31 +02:00
|
|
|
import React from 'react';
|
2016-01-16 14:06:22 +02:00
|
|
|
|
|
|
|
import { FormattedMessage as Message } from 'react-intl';
|
2016-01-19 08:17:21 +02:00
|
|
|
import Helmet from 'react-helmet';
|
2016-02-28 00:26:13 +03:00
|
|
|
import { Link } from 'react-router';
|
2016-01-16 14:06:22 +02:00
|
|
|
|
|
|
|
import buttons from 'components/ui/buttons.scss';
|
|
|
|
import icons from 'components/ui/icons.scss';
|
|
|
|
import { Input, Checkbox } from 'components/ui/Form';
|
|
|
|
|
2016-03-13 10:50:09 +02:00
|
|
|
import BaseAuthBody from 'components/auth/BaseAuthBody';
|
2016-01-19 08:17:21 +02:00
|
|
|
import styles from './password.scss';
|
|
|
|
import messages from './Password.messages';
|
2016-01-16 14:06:22 +02:00
|
|
|
|
2016-02-13 17:28:47 +02:00
|
|
|
class Body extends BaseAuthBody {
|
2016-03-13 10:36:31 +02:00
|
|
|
static displayName = 'PasswordBody';
|
2016-03-28 06:46:51 +03:00
|
|
|
static panelId = 'password';
|
|
|
|
static hasGoBack = true;
|
2016-01-31 14:59:38 +02:00
|
|
|
|
2016-02-13 17:28:47 +02:00
|
|
|
render() {
|
2016-03-13 10:36:31 +02:00
|
|
|
const {user} = this.context;
|
2016-02-13 17:28:47 +02:00
|
|
|
|
|
|
|
return (
|
2016-01-31 14:59:38 +02:00
|
|
|
<div>
|
2016-02-13 17:28:47 +02:00
|
|
|
{this.renderErrors()}
|
|
|
|
|
2016-01-31 14:59:38 +02:00
|
|
|
<div className={styles.miniProfile}>
|
|
|
|
<div className={styles.avatar}>
|
2016-02-13 17:28:47 +02:00
|
|
|
{user.avatar
|
|
|
|
? <img src={user.avatar} />
|
|
|
|
: <span className={icons.user} />
|
|
|
|
}
|
2016-01-31 14:59:38 +02:00
|
|
|
</div>
|
|
|
|
<div className={styles.email}>
|
2016-02-13 17:28:47 +02:00
|
|
|
{user.email || user.username}
|
2016-01-31 14:59:38 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-02-13 17:28:47 +02:00
|
|
|
<Input {...this.bindField('password')}
|
|
|
|
icon="key"
|
|
|
|
type="password"
|
|
|
|
autoFocus
|
2016-03-12 16:23:55 +02:00
|
|
|
onFocus={this.fixAutoFocus}
|
2016-02-13 17:28:47 +02:00
|
|
|
required
|
|
|
|
placeholder={messages.accountPassword}
|
|
|
|
/>
|
2016-01-31 14:59:38 +02:00
|
|
|
|
2016-02-13 17:28:47 +02:00
|
|
|
<Checkbox {...this.bindField('rememberMe')} label={<Message {...messages.rememberMe} />} />
|
2016-01-31 14:59:38 +02:00
|
|
|
</div>
|
2016-02-13 17:28:47 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2016-01-31 14:59:38 +02:00
|
|
|
|
2016-02-13 17:28:47 +02:00
|
|
|
export default function Password() {
|
|
|
|
return {
|
2016-03-28 06:46:51 +03:00
|
|
|
Title: () => ( // TODO: separate component for PageTitle
|
|
|
|
<Message {...messages.passwordTitle}>
|
|
|
|
{(msg) => <span>{msg}<Helmet title={msg} /></span>}
|
|
|
|
</Message>
|
|
|
|
),
|
2016-02-13 17:28:47 +02:00
|
|
|
Body,
|
|
|
|
Footer: () => (
|
|
|
|
<button className={buttons.green} type="submit">
|
2016-01-31 14:59:38 +02:00
|
|
|
<Message {...messages.signInButton} />
|
|
|
|
</button>
|
|
|
|
),
|
|
|
|
Links: () => (
|
2016-02-28 00:26:13 +03:00
|
|
|
<Link to="/forgot-password">
|
2016-01-31 14:59:38 +02:00
|
|
|
<Message {...messages.forgotPassword} />
|
2016-02-28 00:26:13 +03:00
|
|
|
</Link>
|
2016-01-31 14:59:38 +02:00
|
|
|
)
|
|
|
|
};
|
|
|
|
}
|