Null-guard the recaptcha setup

Fixes https://github.com/vector-im/riot-web/issues/11069
This commit is contained in:
Travis Ralston 2019-10-07 12:36:07 +01:00
parent 7d96517139
commit 082ebe636e
2 changed files with 11 additions and 3 deletions

View file

@ -190,14 +190,21 @@ 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 - check your server configuration");
} 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>
);
}