Merge pull request #3526 from matrix-org/travis/recaptcha-fix

Null-guard the recaptcha setup
This commit is contained in:
Travis Ralston 2019-10-07 13:05:52 +01:00 committed by GitHub
commit 9200c55ce0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View file

@ -190,14 +190,24 @@ export const RecaptchaAuthEntry = createReactClass({
return <Loader />;
}
let errorText = this.props.errorText;
const CaptchaForm = sdk.getComponent("views.auth.CaptchaForm");
const sitePublicKey = this.props.stageParams.public_key;
let sitePublicKey;
if (!this.props.stageParams || !this.props.stageParams.public_key) {
errorText = _t(
"Missing captcha public key in homeserver configuration. Please report " +
"this to your homeserver administrator.",
);
} else {
sitePublicKey = this.props.stageParams.public_key;
}
let errorSection;
if (this.props.errorText) {
if (errorText) {
errorSection = (
<div className="error" role="alert">
{ this.props.errorText }
{ errorText }
</div>
);
}