Refactor CaptchaForm to put less logic in signupstages

A bunch of work being done in the Recaptcha signupstage makes more sense in
the CaptchaForm; let's move it.
This commit is contained in:
Richard van der Hoff 2016-10-11 18:00:47 +01:00
parent 6ffddabaaa
commit eb36509620
3 changed files with 77 additions and 68 deletions

View file

@ -228,12 +228,9 @@ module.exports = React.createClass({
});
},
onCaptchaLoaded: function(divIdName) {
onCaptchaResponse: function(response) {
this.registerLogic.tellStage("m.login.recaptcha", {
divId: divIdName
});
this.setState({
busy: false // requires user input
response: response
});
},
@ -267,8 +264,15 @@ module.exports = React.createClass({
);
break;
case "Register.STEP_m.login.recaptcha":
var publicKey;
var serverParams = this.registerLogic.getServerData().params;
if (serverParams && serverParams["m.login.recaptcha"]) {
publicKey = serverParams["m.login.recaptcha"].public_key;
}
registerStep = (
<CaptchaForm onCaptchaLoaded={this.onCaptchaLoaded} />
<CaptchaForm sitePublicKey={publicKey}
onCaptchaResponse={this.onCaptchaResponse}
/>
);
break;
default: