|
|
|
@ -3,18 +3,30 @@ import { connect } from 'react-redux';
|
|
|
|
|
import { injectIntl, FormattedMessage, defineMessages } from 'react-intl';
|
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
|
import { getFeatures } from 'soapbox/utils/features';
|
|
|
|
|
import { getBaseURL } from 'soapbox/utils/state';
|
|
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
|
username: { id: 'login.fields.username_placeholder', defaultMessage: 'Username' },
|
|
|
|
|
password: { id: 'login.fields.password_placeholder', defaultMessage: 'Password' },
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default @connect()
|
|
|
|
|
const mapStateToProps = state => {
|
|
|
|
|
const instance = state.get('instance');
|
|
|
|
|
const features = getFeatures(instance);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
baseURL: getBaseURL(state),
|
|
|
|
|
hasResetPasswordAPI: features.resetPasswordAPI,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default @connect(mapStateToProps)
|
|
|
|
|
@injectIntl
|
|
|
|
|
class LoginForm extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { intl, isLoading, handleSubmit } = this.props;
|
|
|
|
|
const { intl, isLoading, handleSubmit, baseURL, hasResetPasswordAPI } = this.props;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<form className='simple_form new_user' method='post' onSubmit={handleSubmit}>
|
|
|
|
@ -43,9 +55,15 @@ class LoginForm extends ImmutablePureComponent {
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<p className='hint subtle-hint'>
|
|
|
|
|
{hasResetPasswordAPI ? (
|
|
|
|
|
<Link to='/auth/reset_password'>
|
|
|
|
|
<FormattedMessage id='login.reset_password_hint' defaultMessage='Trouble logging in?' />
|
|
|
|
|
</Link>
|
|
|
|
|
) : (
|
|
|
|
|
<a href={`${baseURL}/auth/password/new`}>
|
|
|
|
|
<FormattedMessage id='login.reset_password_hint' defaultMessage='Trouble logging in?' />
|
|
|
|
|
</a>
|
|
|
|
|
)}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|