From 88d0ae05726652dcc90cbf9966d88fc554412206 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 28 Oct 2019 14:13:24 +0000 Subject: [PATCH] Remove messages implying you need an identity server for email recovery This tweaks logic that shows some warning messages saying you need an identity server for email recovery. Assuming you have a modern homeserver, no identity server is need for these activities, so the warnings were confusing. Fixes https://github.com/vector-im/riot-web/issues/11100 --- src/components/views/auth/RegistrationForm.js | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/components/views/auth/RegistrationForm.js b/src/components/views/auth/RegistrationForm.js index 5d4dadca9d..1ea66176ff 100644 --- a/src/components/views/auth/RegistrationForm.js +++ b/src/components/views/auth/RegistrationForm.js @@ -97,16 +97,16 @@ module.exports = createReactClass({ const haveIs = Boolean(this.props.serverConfig.isUrl); let desc; - if (haveIs) { - desc = _t( - "If you don't specify an email address, you won't be able to reset your password. " + - "Are you sure?", - ); - } else { + if (this.props.serverRequiresIdServer && !haveIs) { desc = _t( "No Identity Server is configured so you cannot add add an email address in order to " + "reset your password in the future.", ); + } else { + desc = _t( + "If you don't specify an email address, you won't be able to reset your password. " + + "Are you sure?", + ); } const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); @@ -439,7 +439,10 @@ module.exports = createReactClass({ _showEmail() { const haveIs = Boolean(this.props.serverConfig.isUrl); - if ((this.props.serverRequiresIdServer && !haveIs) || !this._authStepIsUsed('m.login.email.identity')) { + if ( + (this.props.serverRequiresIdServer && !haveIs) || + !this._authStepIsUsed('m.login.email.identity') + ) { return false; } return true; @@ -448,8 +451,11 @@ module.exports = createReactClass({ _showPhoneNumber() { const threePidLogin = !SdkConfig.get().disable_3pid_login; const haveIs = Boolean(this.props.serverConfig.isUrl); - const haveRequiredIs = this.props.serverRequiresIdServer && !haveIs; - if (!threePidLogin || haveRequiredIs || !this._authStepIsUsed('m.login.msisdn')) { + if ( + !threePidLogin || + (this.props.serverRequiresIdServer && !haveIs) || + !this._authStepIsUsed('m.login.msisdn') + ) { return false; } return true; @@ -592,12 +598,15 @@ module.exports = createReactClass({ } } const haveIs = Boolean(this.props.serverConfig.isUrl); - const noIsText = haveIs ? null :
- {_t( - "No Identity Server is configured: no email addreses can be added. " + - "You will be unable to reset your password.", - )} -
; + let noIsText = null; + if (this.props.serverRequiresIdServer && !haveIs) { + noIsText =
+ {_t( + "No Identity Server is configured: no email addreses can be added. " + + "You will be unable to reset your password.", + )} +
; + } return (