import React from 'react'; import PropTypes from 'prop-types'; import Layout from 'coral-admin/src/components/Layout'; import styles from './NotFound.css'; import { Button, TextField, Alert, Success } from 'coral-ui'; import Recaptcha from 'react-recaptcha'; import cn from 'classnames'; import t from 'coral-framework/services/i18n'; class AdminLogin extends React.Component { constructor(props) { super(props); this.state = { email: '', password: '', requestPassword: false }; } handleSignIn = e => { e.preventDefault(); this.props.handleLogin(this.state.email, this.state.password); }; onRecaptchaLoad = () => { // do something? }; onRecaptchaVerify = recaptchaResponse => { this.props.handleLogin( this.state.email, this.state.password, recaptchaResponse ); }; handleRequestPassword = e => { e.preventDefault(); this.props.requestPasswordReset(this.state.email); }; render() { const { errorMessage, loginMaxExceeded, recaptchaPublic } = this.props; const signInForm = (
); const requestPasswordForm = this.props.passwordRequestSuccess ? ( {
location.href = location.href;
}}
>
{this.props.passwordRequestSuccess}{' '}
{t('login.sign_in')}
{t('login.sign_in_message')}
{this.state.requestPassword ? requestPasswordForm : signInForm}