Avoid hsName for auth headers which can be outdated

`hsName` uses only the default HS, so that can easily be outdated if the HS URL
is customized.
This commit is contained in:
J. Ryan Stinnett 2019-01-30 00:33:29 -06:00
parent f5e3b90fc3
commit cfe19d710b
5 changed files with 13 additions and 34 deletions

View file

@ -41,7 +41,6 @@ class PasswordLogin extends React.Component {
initialPassword: "",
loginIncorrect: false,
hsUrl: "",
hsName: null,
disableSubmit: false,
}
@ -251,15 +250,13 @@ class PasswordLogin extends React.Component {
}
let yourMatrixAccountText = _t('Your account');
if (this.props.hsName) {
yourMatrixAccountText = _t('Your %(serverName)s account', {serverName: this.props.hsName});
} else {
try {
const parsedHsUrl = new URL(this.props.hsUrl);
yourMatrixAccountText = _t('Your %(serverName)s account', {serverName: parsedHsUrl.hostname});
} catch (e) {
// ignore
}
try {
const parsedHsUrl = new URL(this.props.hsUrl);
yourMatrixAccountText = _t('Your %(serverName)s account', {
serverName: parsedHsUrl.hostname,
});
} catch (e) {
// ignore
}
let editLink = null;
@ -341,7 +338,6 @@ PasswordLogin.propTypes = {
onPhoneNumberChanged: PropTypes.func,
onPasswordChanged: PropTypes.func,
loginIncorrect: PropTypes.bool,
hsName: PropTypes.string,
disableSubmit: PropTypes.bool,
};