From 082ebe636e3544666ba1864463b06b94c0c2356e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 7 Oct 2019 12:36:07 +0100 Subject: [PATCH] Null-guard the recaptcha setup Fixes https://github.com/vector-im/riot-web/issues/11069 --- .../views/auth/InteractiveAuthEntryComponents.js | 13 ++++++++++--- src/i18n/strings/en_EN.json | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.js b/src/components/views/auth/InteractiveAuthEntryComponents.js index f7bba5ba4a..eaff2d0543 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.js +++ b/src/components/views/auth/InteractiveAuthEntryComponents.js @@ -190,14 +190,21 @@ export const RecaptchaAuthEntry = createReactClass({ return ; } + 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 = (
- { this.props.errorText } + { errorText }
); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index b303b7a94d..f1ff2982fd 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1478,6 +1478,7 @@ "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.", "You can also set a custom identity server, but you won't be able to invite users by email address, or be invited by email address yourself.": "You can also set a custom identity server, but you won't be able to invite users by email address, or be invited by email address yourself.", "To continue, please enter your password.": "To continue, please enter your password.", + "Missing captcha public key - check your server configuration": "Missing captcha public key - check your server configuration", "Please review and accept all of the homeserver's policies": "Please review and accept all of the homeserver's policies", "Please review and accept the policies of this homeserver:": "Please review and accept the policies of this homeserver:", "An email has been sent to %(emailAddress)s": "An email has been sent to %(emailAddress)s",