|
|
@@ -11,8 +11,6 @@ import TextInput from '../TextInput';
|
|
|
import Button from '../Button';
|
|
|
import Error from '../Error';
|
|
|
import { loginUser, showAuthError, signupUser, showPageLoading } from '../../actions';
|
|
|
-import showRecaptcha from '../../helpers/recaptcha';
|
|
|
-import config from '../../config';
|
|
|
|
|
|
const Wrapper = styled.div`
|
|
|
flex: 0 0 auto;
|
|
|
@@ -61,11 +59,6 @@ const ForgetPassLink = styled.a`
|
|
|
}
|
|
|
`;
|
|
|
|
|
|
-const Recaptcha = styled.div`
|
|
|
- display: block;
|
|
|
- margin: 0 0 32px 0;
|
|
|
-`;
|
|
|
-
|
|
|
class Login extends Component {
|
|
|
constructor() {
|
|
|
super();
|
|
|
@@ -75,10 +68,6 @@ class Login extends Component {
|
|
|
this.goTo = this.goTo.bind(this);
|
|
|
}
|
|
|
|
|
|
- componentDidMount() {
|
|
|
- showRecaptcha();
|
|
|
- }
|
|
|
-
|
|
|
goTo(e) {
|
|
|
e.preventDefault();
|
|
|
const path = e.currentTarget.getAttribute('href');
|
|
|
@@ -92,20 +81,14 @@ class Login extends Component {
|
|
|
const form = document.getElementById('login-form');
|
|
|
const { value: email } = form.elements.email;
|
|
|
const { value: password } = form.elements.password;
|
|
|
- const { value: reCaptchaToken } = form.elements['g-recaptcha-input'];
|
|
|
if (!email) return showError('Email address must not be empty.');
|
|
|
if (!emailValidator.validate(email)) return showError('Email address is not valid.');
|
|
|
if (password.trim().length < 8) {
|
|
|
return showError('Password must be at least 8 chars long.');
|
|
|
}
|
|
|
- if (!reCaptchaToken) {
|
|
|
- window.grecaptcha.reset();
|
|
|
- return showError('reCAPTCHA is not valid. Try again.');
|
|
|
- }
|
|
|
- window.grecaptcha.reset();
|
|
|
return type === 'login'
|
|
|
- ? this.props.login({ email, password, reCaptchaToken })
|
|
|
- : this.props.signup({ email, password, reCaptchaToken });
|
|
|
+ ? this.props.login({ email, password })
|
|
|
+ : this.props.signup({ email, password });
|
|
|
}
|
|
|
|
|
|
loginHandler(e) {
|
|
|
@@ -133,13 +116,6 @@ class Login extends Component {
|
|
|
<TextInput type="email" name="email" id="email" autoFocus />
|
|
|
<LoginInputLabel htmlFor="password">Password (min chars: 8)</LoginInputLabel>
|
|
|
<TextInput type="password" name="password" id="password" />
|
|
|
- <Recaptcha
|
|
|
- id="g-recaptcha"
|
|
|
- className="g-recaptcha"
|
|
|
- data-sitekey={config.RECAPTCHA_SITE_KEY}
|
|
|
- data-callback="recaptchaCallback"
|
|
|
- />
|
|
|
- <input type="hidden" id="g-recaptcha-input" name="g-recaptcha-input" />
|
|
|
<ForgetPassLink href="/reset-password" title="Forget password" onClick={this.goTo}>
|
|
|
Forgot your password?
|
|
|
</ForgetPassLink>
|