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
pull/21833/head
J. Ryan Stinnett 2019-10-28 14:13:24 +00:00
parent a0aef67793
commit 88d0ae0572
1 changed files with 24 additions and 15 deletions

View File

@ -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 : <div>
{_t(
"No Identity Server is configured: no email addreses can be added. " +
"You will be unable to reset your password.",
)}
</div>;
let noIsText = null;
if (this.props.serverRequiresIdServer && !haveIs) {
noIsText = <div>
{_t(
"No Identity Server is configured: no email addreses can be added. " +
"You will be unable to reset your password.",
)}
</div>;
}
return (
<div>