Updates #5375 Squashed commit of the following: commit 40666b010697381e11b3a36d9c2ed1c1507f27ed Author: Arseny Lisin <a.lisin@adguard.com> Date: Tue Jan 31 18:34:06 2023 +0200 Review fix commit 44f3d6095bc9b426e8142f8c9d915a1441f3d791 Author: Arseny Lisin <a.lisin@adguard.com> Date: Tue Jan 31 17:02:38 2023 +0200 Clear commit 44274ba54c9ff2bd2caf5fa69bf06c587f8858e5 Author: Arseny Lisin <a.lisin@adguard.com> Date: Tue Jan 31 13:25:01 2023 +0200 Clear commit 8b48c523cbbe3f73160331a9c516388c7965a7a2 Author: Arseny Lisin <a.lisin@adguard.com> Date: Tue Jan 31 12:14:37 2023 +0200 Review fix commit 3b8cd94cdd8d3fc90cdc27053964489414055cc9 Author: Arseny Lisin <a.lisin@adguard.com> Date: Mon Jan 30 16:13:15 2023 +0200 Fix query log popup bg commit 14d4c87164200f7c918bac02c9cc5f1cffb83932 Author: Arseny Lisin <a.lisin@adguard.com> Date: Mon Jan 30 15:03:06 2023 +0200 revert icons commit 98b042726e1510f85c9cf5a4caba2d56885f120b Author: Arseny Lisin <a.lisin@adguard.com> Date: Mon Jan 30 14:45:35 2023 +0200 Fix dark theme bugs
91 lines
3.0 KiB
JavaScript
91 lines
3.0 KiB
JavaScript
import React, { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import PropTypes from 'prop-types';
|
|
import flow from 'lodash/flow';
|
|
import { withTranslation, Trans } from 'react-i18next';
|
|
|
|
import * as actionCreators from '../../actions/login';
|
|
import logo from '../../components/ui/svg/logo.svg';
|
|
import Toasts from '../../components/Toasts';
|
|
import Footer from '../../components/ui/Footer';
|
|
import Form from './Form';
|
|
|
|
import './Login.css';
|
|
import '../../components/ui/Tabler.css';
|
|
|
|
class Login extends Component {
|
|
state = {
|
|
isForgotPasswordVisible: false,
|
|
};
|
|
|
|
handleSubmit = ({ username: name, password }) => {
|
|
this.props.processLogin({ name, password });
|
|
};
|
|
|
|
toggleText = () => {
|
|
this.setState((prevState) => ({
|
|
isForgotPasswordVisible: !prevState.isForgotPasswordVisible,
|
|
}));
|
|
};
|
|
|
|
render() {
|
|
const { processingLogin } = this.props.login;
|
|
const { isForgotPasswordVisible } = this.state;
|
|
|
|
return (
|
|
<div className="login">
|
|
<div className="login__form">
|
|
<div className="text-center mb-6">
|
|
<img src={logo} className="h-6 login__logo" alt="logo" />
|
|
</div>
|
|
<Form onSubmit={this.handleSubmit} processing={processingLogin} />
|
|
<div className="login__info">
|
|
<button
|
|
type="button"
|
|
className="btn btn-link login__link"
|
|
onClick={this.toggleText}
|
|
>
|
|
<Trans>forgot_password</Trans>
|
|
</button>
|
|
{isForgotPasswordVisible && (
|
|
<div className="login__message">
|
|
<Trans
|
|
components={[
|
|
<a
|
|
href="https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration#password-reset"
|
|
key="0"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>
|
|
link
|
|
</a>,
|
|
]}
|
|
>
|
|
forgot_password_desc
|
|
</Trans>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
<Footer />
|
|
<Toasts />
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
Login.propTypes = {
|
|
login: PropTypes.object.isRequired,
|
|
processLogin: PropTypes.func.isRequired,
|
|
};
|
|
|
|
const mapStateToProps = ({ login, toasts }) => ({ login, toasts });
|
|
|
|
export default flow([
|
|
withTranslation(),
|
|
connect(
|
|
mapStateToProps,
|
|
actionCreators,
|
|
),
|
|
])(Login);
|