import React from 'react'; import PropTypes from 'prop-types'; import { Button, TextField, Spinner, Alert, } from 'plugin-api/beta/client/components/ui'; import styles from './SignIn.css'; import { t } from 'plugin-api/beta/client/services'; import cn from 'classnames'; import { Recaptcha } from 'plugin-api/beta/client/components'; import External from './External'; class SignIn extends React.Component { recaptcha = null; handleForgotPasswordLink = e => { e.preventDefault(); this.props.onForgotPasswordLink(); }; handleSignUpLink = e => { e.preventDefault(); this.props.onSignUpLink(); }; handleEmailChange = e => this.props.onEmailChange(e.target.value); handlePasswordChange = e => this.props.onPasswordChange(e.target.value); handleSubmit = e => { e.preventDefault(); this.props.onSubmit(); // Reset recaptcha because each response can only // be used once. if (this.recaptcha) { this.recaptcha.reset(); } }; handleRecaptchaRef = ref => { this.recaptcha = ref; }; render() { const { email, password, errorMessage, requireRecaptcha, loading, } = this.props; return (