mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
- Undo bad merge changing name of validateEmail function
- Move loading of capcha js to final step - add in onload and onerror callbacks for catpcha js loading
This commit is contained in:
parent
d2cb0818c8
commit
f83fa4390c
2 changed files with 8 additions and 16 deletions
|
@ -19,10 +19,12 @@ class EmailStep extends React.Component {
|
|||
bindAll(this, [
|
||||
'handleSetEmailRef',
|
||||
'handleValidSubmit',
|
||||
'validateEmailIfPresent',
|
||||
'validateEmail',
|
||||
'validateForm',
|
||||
'setCaptchaRef',
|
||||
'captchaSolved'
|
||||
'captchaSolved',
|
||||
'onCaptchaLoad',
|
||||
'onCaptchaError'
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -31,12 +33,11 @@ class EmailStep extends React.Component {
|
|||
if (this.emailInput) this.emailInput.focus();
|
||||
this.grecaptcha = window.grecaptcha;
|
||||
if (!this.grecaptcha) {
|
||||
// Captcha doesn't exist on the window. There must have been a
|
||||
// problem downloading the script. There isn't much we can do about it though.
|
||||
// TODO: put up the error screen when we have it.
|
||||
return;
|
||||
// According to the reCaptcha documentation, this callback shouldn't get
|
||||
// called unless window.grecaptcha exists. This is just here to be extra defensive.
|
||||
// TODO: Put up the error screen when we have one.
|
||||
}
|
||||
// TODO: Add in error callback for this once we have an error screen.
|
||||
// TODO: Add in error callback for render once we have an error screen.
|
||||
this.widgetId = this.grecaptcha.render(this.captchaRef,
|
||||
{
|
||||
callback: this.captchaSolved,
|
||||
|
|
|
@ -30,15 +30,6 @@ class JoinFlow extends React.Component {
|
|||
};
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
// Load Google Captcha script so that it is ready to go when we get to
|
||||
// the last step.
|
||||
const script = document.createElement('script');
|
||||
script.src = `https://www.recaptcha.net/recaptcha/api.js?render=explicit&hl=${window._locale}`;
|
||||
script.async = true;
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
handleAdvanceStep (formData) {
|
||||
formData = formData || {};
|
||||
this.setState({
|
||||
|
|
Loading…
Reference in a new issue