mirror of https://github.com/vector-im/riot-web
Merge pull request #3924 from matrix-org/travis/sso-pw
Hide password section if you can't change your passwordpull/21833/head
commit
d3960b8c54
|
@ -70,7 +70,16 @@ export default class GeneralUserSettingsTab extends React.Component {
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
|
|
||||||
const serverSupportsSeparateAddAndBind = await cli.doesServerSupportSeparateAddAndBind();
|
const serverSupportsSeparateAddAndBind = await cli.doesServerSupportSeparateAddAndBind();
|
||||||
this.setState({serverSupportsSeparateAddAndBind});
|
|
||||||
|
const capabilities = await cli.getCapabilities(); // this is cached
|
||||||
|
const changePasswordCap = capabilities['m.change_password'];
|
||||||
|
|
||||||
|
// You can change your password so long as the capability isn't explicitly disabled. The implicit
|
||||||
|
// behaviour is you can change your password when the capability is missing or has not-false as
|
||||||
|
// the enabled flag value.
|
||||||
|
const canChangePassword = !changePasswordCap || changePasswordCap['enabled'] !== false;
|
||||||
|
|
||||||
|
this.setState({serverSupportsSeparateAddAndBind, canChangePassword});
|
||||||
|
|
||||||
this._getThreepidState();
|
this._getThreepidState();
|
||||||
}
|
}
|
||||||
|
@ -280,7 +289,7 @@ export default class GeneralUserSettingsTab extends React.Component {
|
||||||
const PhoneNumbers = sdk.getComponent("views.settings.account.PhoneNumbers");
|
const PhoneNumbers = sdk.getComponent("views.settings.account.PhoneNumbers");
|
||||||
const Spinner = sdk.getComponent("views.elements.Spinner");
|
const Spinner = sdk.getComponent("views.elements.Spinner");
|
||||||
|
|
||||||
const passwordChangeForm = (
|
let passwordChangeForm = (
|
||||||
<ChangePassword
|
<ChangePassword
|
||||||
className="mx_GeneralUserSettingsTab_changePassword"
|
className="mx_GeneralUserSettingsTab_changePassword"
|
||||||
rowClassName=""
|
rowClassName=""
|
||||||
|
@ -314,11 +323,18 @@ export default class GeneralUserSettingsTab extends React.Component {
|
||||||
threepidSection = <Spinner />;
|
threepidSection = <Spinner />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let passwordChangeText = _t("Set a new account password...");
|
||||||
|
if (!this.state.canChangePassword) {
|
||||||
|
// Just don't show anything if you can't do anything.
|
||||||
|
passwordChangeText = null;
|
||||||
|
passwordChangeForm = null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_SettingsTab_section mx_GeneralUserSettingsTab_accountSection">
|
<div className="mx_SettingsTab_section mx_GeneralUserSettingsTab_accountSection">
|
||||||
<span className="mx_SettingsTab_subheading">{_t("Account")}</span>
|
<span className="mx_SettingsTab_subheading">{_t("Account")}</span>
|
||||||
<p className="mx_SettingsTab_subsectionText">
|
<p className="mx_SettingsTab_subsectionText">
|
||||||
{_t("Set a new account password...")}
|
{passwordChangeText}
|
||||||
</p>
|
</p>
|
||||||
{passwordChangeForm}
|
{passwordChangeForm}
|
||||||
{threepidSection}
|
{threepidSection}
|
||||||
|
|
|
@ -665,8 +665,8 @@
|
||||||
"Profile": "Profile",
|
"Profile": "Profile",
|
||||||
"Email addresses": "Email addresses",
|
"Email addresses": "Email addresses",
|
||||||
"Phone numbers": "Phone numbers",
|
"Phone numbers": "Phone numbers",
|
||||||
"Account": "Account",
|
|
||||||
"Set a new account password...": "Set a new account password...",
|
"Set a new account password...": "Set a new account password...",
|
||||||
|
"Account": "Account",
|
||||||
"Language and region": "Language and region",
|
"Language and region": "Language and region",
|
||||||
"Theme": "Theme",
|
"Theme": "Theme",
|
||||||
"Agree to the identity server (%(serverName)s) Terms of Service to allow yourself to be discoverable by email address or phone number.": "Agree to the identity server (%(serverName)s) Terms of Service to allow yourself to be discoverable by email address or phone number.",
|
"Agree to the identity server (%(serverName)s) Terms of Service to allow yourself to be discoverable by email address or phone number.": "Agree to the identity server (%(serverName)s) Terms of Service to allow yourself to be discoverable by email address or phone number.",
|
||||||
|
|
Loading…
Reference in New Issue