Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Support for linking out to MSC2965 issuer account management URL #8727

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ interface IState {
loading3pids: boolean; // whether or not the emails and msisdns have been loaded
canChangePassword: boolean;
idServerName: string;
externalAccountManagementUrl: string;
}

export default class GeneralUserSettingsTab extends React.Component<IProps, IState> {
Expand All @@ -100,6 +101,7 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
loading3pids: true, // whether or not the emails and msisdns have been loaded
canChangePassword: false,
idServerName: null,
externalAccountManagementUrl: null,
};

this.dispatcherRef = dis.register(this.onAction);
Expand All @@ -120,7 +122,9 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
// the enabled flag value.
const canChangePassword = !changePasswordCap || changePasswordCap['enabled'] !== false;

this.setState({ serverSupportsSeparateAddAndBind, canChangePassword });
const externalAccountManagementUrl = (await cli.waitForClientWellKnown())['m.authentication']?.account;

this.setState({ serverSupportsSeparateAddAndBind, canChangePassword, externalAccountManagementUrl });

this.getThreepidState();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above await now slows down the call to getThreepidState

}
Expand Down Expand Up @@ -340,9 +344,29 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
passwordChangeForm = null;
}

let externalAccountManagement = null;
if (this.state.externalAccountManagementUrl) {
const externalAccountManagementText = _t(
'You can manage your account <a>here</a>.',
{},
{
'a': (sub) => <a
href={this.state.externalAccountManagementUrl}
rel="noopener"
target="_blank"
>
{ sub }
</a>,
},
);
externalAccountManagement = <p className="mx_SettingsTab_subsectionText">
{ externalAccountManagementText }
</p>;
}
return (
<div className="mx_SettingsTab_section mx_GeneralUserSettingsTab_accountSection">
<span className="mx_SettingsTab_subheading">{ _t("Account") }</span>
{ externalAccountManagement }
<p className="mx_SettingsTab_subsectionText">
{ passwordChangeText }
</p>
Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,7 @@
"Email addresses": "Email addresses",
"Phone numbers": "Phone numbers",
"Set a new account password...": "Set a new account password...",
"You can manage your account <a>here</a>.": "You can manage your account <a>here</a>.",
"Account": "Account",
"Language and region": "Language and region",
"Spell check dictionaries": "Spell check dictionaries",
Expand Down