Make it clearer which HS you're logging into

Otherwise there's no indication without clicking 'custom server'
This commit is contained in:
David Baker 2017-10-10 19:16:42 +01:00
parent 2ba0a801c4
commit 92be3af990
4 changed files with 26 additions and 2 deletions

View file

@ -186,6 +186,17 @@ class PasswordLogin extends React.Component {
const loginField = this.renderLoginField(this.state.loginType);
let matrixIdText = '';
if (this.props.hsUrl) {
try {
const parsedHsUrl = new URL(this.props.hsUrl);
matrixIdText = _t('%(serverName)s Matrix ID', {serverName: parsedHsUrl.hostname});
} catch (e) {
console.log(e);
// pass
}
}
return (
<div>
<form onSubmit={this.onSubmitForm}>
@ -194,8 +205,9 @@ class PasswordLogin extends React.Component {
<Dropdown
className="mx_Login_type_dropdown"
value={this.state.loginType}
disabled={matrixIdText === ''}
onOptionChange={this.onLoginTypeChange}>
<span key={PasswordLogin.LOGIN_FIELD_MXID}>{ _t('my Matrix ID') }</span>
<span key={PasswordLogin.LOGIN_FIELD_MXID}>{matrixIdText}</span>
<span key={PasswordLogin.LOGIN_FIELD_EMAIL}>{ _t('Email address') }</span>
<span key={PasswordLogin.LOGIN_FIELD_PHONE}>{ _t('Phone') }</span>
</Dropdown>