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

@ -51,6 +51,7 @@ module.exports = React.createClass({
onRegisterClick: PropTypes.func.isRequired, // onRegisterClick(Object) => ?Promise
onEditServerDetailsClick: PropTypes.func,
flows: PropTypes.arrayOf(PropTypes.object).isRequired,
hsUrl: PropTypes.string,
},
getDefaultProps: function() {
@ -258,19 +259,13 @@ module.exports = React.createClass({
const self = this;
let yourMatrixAccountText = _t('Create your account');
if (this.props.hsName) {
try {
const parsedHsUrl = new URL(this.props.hsUrl);
yourMatrixAccountText = _t('Create your %(serverName)s account', {
serverName: this.props.hsName,
serverName: parsedHsUrl.hostname,
});
} else {
try {
const parsedHsUrl = new URL(this.props.hsUrl);
yourMatrixAccountText = _t('Create your %(serverName)s account', {
serverName: parsedHsUrl.hostname,
});
} catch (e) {
// ignore
}
} catch (e) {
// ignore
}
let editLink = null;