From 082ebe636e3544666ba1864463b06b94c0c2356e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 7 Oct 2019 12:36:07 +0100 Subject: [PATCH 1/4] 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", From e841bd5442534b6d7c087371ccbd2da364d6202b Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 7 Oct 2019 12:43:07 +0100 Subject: [PATCH 2/4] Update src/components/views/auth/InteractiveAuthEntryComponents.js Co-Authored-By: J. Ryan Stinnett --- src/components/views/auth/InteractiveAuthEntryComponents.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.js b/src/components/views/auth/InteractiveAuthEntryComponents.js index eaff2d0543..4541ce15f7 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.js +++ b/src/components/views/auth/InteractiveAuthEntryComponents.js @@ -195,7 +195,7 @@ export const RecaptchaAuthEntry = createReactClass({ const CaptchaForm = sdk.getComponent("views.auth.CaptchaForm"); let sitePublicKey; if (!this.props.stageParams || !this.props.stageParams.public_key) { - errorText = _t("Missing captcha public key - check your server configuration"); + errorText = _t("Missing captcha public key in homeserver configuration. Please report this to your homeserver administrator."); } else { sitePublicKey = this.props.stageParams.public_key; } From afaaa6774e1898b397a5b4c19ab37ae40b3f34d0 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 7 Oct 2019 12:43:30 +0100 Subject: [PATCH 3/4] Update i18n --- src/i18n/strings/en_EN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index f1ff2982fd..fc094f48f6 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1478,7 +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", + "Missing captcha public key in homeserver configuration. Please report this to your homeserver administrator.": "Missing captcha public key in homeserver configuration. Please report this to your homeserver administrator.", "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", From 495513028c15dc0538caf504a74b6d649daf6d67 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 7 Oct 2019 12:46:14 +0100 Subject: [PATCH 4/4] Appease the linter --- src/components/views/auth/InteractiveAuthEntryComponents.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.js b/src/components/views/auth/InteractiveAuthEntryComponents.js index 4541ce15f7..359dcd1398 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.js +++ b/src/components/views/auth/InteractiveAuthEntryComponents.js @@ -195,7 +195,10 @@ export const RecaptchaAuthEntry = createReactClass({ const CaptchaForm = sdk.getComponent("views.auth.CaptchaForm"); 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."); + errorText = _t( + "Missing captcha public key in homeserver configuration. Please report " + + "this to your homeserver administrator.", + ); } else { sitePublicKey = this.props.stageParams.public_key; }