mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-22 23:27:54 -05:00
Merge pull request #3191 from LLK/hotfix/registration-recaptcha
[Master] Adjust height when displaying reCAPTCHA challenge
This commit is contained in:
commit
46af442541
2 changed files with 15 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
const bindAll = require('lodash.bindall');
|
const bindAll = require('lodash.bindall');
|
||||||
|
const classNames = require('classnames');
|
||||||
const PropTypes = require('prop-types');
|
const PropTypes = require('prop-types');
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const connect = require('react-redux').connect;
|
const connect = require('react-redux').connect;
|
||||||
|
@ -15,12 +16,14 @@ class Registration extends React.Component {
|
||||||
'handleMessage',
|
'handleMessage',
|
||||||
'toggleMessageListener'
|
'toggleMessageListener'
|
||||||
]);
|
]);
|
||||||
|
this.state = {recaptchaOpen: false};
|
||||||
}
|
}
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
if (this.props.isOpen) this.toggleMessageListener(true);
|
if (this.props.isOpen) this.toggleMessageListener(true);
|
||||||
}
|
}
|
||||||
componentDidUpdate (prevProps) {
|
componentDidUpdate (prevProps) {
|
||||||
this.toggleMessageListener(this.props.isOpen && !prevProps.isOpen);
|
if (this.props.isOpen && !prevProps.isOpen) this.toggleMessageListener(true);
|
||||||
|
if (!this.props.isOpen && prevProps.isOpen) this.toggleMessageListener(false);
|
||||||
}
|
}
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
this.toggleMessageListener(false);
|
this.toggleMessageListener(false);
|
||||||
|
@ -32,6 +35,8 @@ class Registration extends React.Component {
|
||||||
if (e.data === 'registration-relaunch') {
|
if (e.data === 'registration-relaunch') {
|
||||||
this.registrationIframe.contentWindow.location.reload();
|
this.registrationIframe.contentWindow.location.reload();
|
||||||
}
|
}
|
||||||
|
if (e.data === 'recaptcha-opened') this.setState({recaptchaOpen: true});
|
||||||
|
if (e.data === 'recaptcha-closed') this.setState({recaptchaOpen: false});
|
||||||
}
|
}
|
||||||
toggleMessageListener (present) {
|
toggleMessageListener (present) {
|
||||||
if (present) {
|
if (present) {
|
||||||
|
@ -43,7 +48,7 @@ class Registration extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<IframeModal
|
<IframeModal
|
||||||
className="mod-registration"
|
className={classNames('mod-registration', {'recaptcha-open': this.state.recaptchaOpen})}
|
||||||
componentRef={iframe => { // eslint-disable-line react/jsx-no-bind
|
componentRef={iframe => { // eslint-disable-line react/jsx-no-bind
|
||||||
this.registrationIframe = iframe;
|
this.registrationIframe = iframe;
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -10,6 +10,14 @@
|
||||||
min-height: 27.375rem;
|
min-height: 27.375rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-content.recaptcha-open {
|
||||||
|
min-height: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content-iframe.recaptcha-open {
|
||||||
|
min-height: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
@media #{$intermediate-and-smaller} {
|
@media #{$intermediate-and-smaller} {
|
||||||
.modal-content.mod-registration {
|
.modal-content.mod-registration {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
Loading…
Reference in a new issue