From 92be3af990ecd96cfa1bbef3bc2cdab3554b819b Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 10 Oct 2017 19:16:42 +0100 Subject: [PATCH] Make it clearer which HS you're logging into Otherwise there's no indication without clicking 'custom server' --- src/components/structures/login/Login.js | 1 + src/components/views/elements/Dropdown.js | 10 ++++++++++ src/components/views/login/PasswordLogin.js | 14 +++++++++++++- src/i18n/strings/en_EN.json | 3 ++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js index a6c0a70c66..b88aa094dc 100644 --- a/src/components/structures/login/Login.js +++ b/src/components/structures/login/Login.js @@ -290,6 +290,7 @@ module.exports = React.createClass({ onPhoneNumberChanged={this.onPhoneNumberChanged} onForgotPasswordClick={this.props.onForgotPasswordClick} loginIncorrect={this.state.loginIncorrect} + hsUrl={this.state.enteredHomeserverUrl} /> ); case 'm.login.cas': diff --git a/src/components/views/elements/Dropdown.js b/src/components/views/elements/Dropdown.js index c049c38a68..1b2117bb6a 100644 --- a/src/components/views/elements/Dropdown.js +++ b/src/components/views/elements/Dropdown.js @@ -26,6 +26,12 @@ class MenuOption extends React.Component { this._onClick = this._onClick.bind(this); } + getDefaultProps() { + return { + disabled: false, + } + } + _onMouseEnter() { this.props.onMouseEnter(this.props.dropdownKey); } @@ -153,6 +159,8 @@ export default class Dropdown extends React.Component { } _onInputClick(ev) { + if (this.props.disabled) return; + if (!this.state.expanded) { this.setState({ expanded: true, @@ -329,4 +337,6 @@ Dropdown.propTypes = { // in the dropped-down menu. getShortOption: React.PropTypes.func, value: React.PropTypes.string, + // negative for consistency with HTML + disabled: React.PropTypes.bool, } diff --git a/src/components/views/login/PasswordLogin.js b/src/components/views/login/PasswordLogin.js index 9f855616fc..4e37e30f65 100644 --- a/src/components/views/login/PasswordLogin.js +++ b/src/components/views/login/PasswordLogin.js @@ -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 (
@@ -194,8 +205,9 @@ class PasswordLogin extends React.Component { - { _t('my Matrix ID') } + {matrixIdText} { _t('Email address') } { _t('Phone') } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 6acaba9fae..8ec975987c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -906,5 +906,6 @@ "Related Groups": "Related Groups", "Related groups for this room:": "Related groups for this room:", "This room has no related groups": "This room has no related groups", - "New group ID (e.g. +foo:%(localDomain)s)": "New group ID (e.g. +foo:%(localDomain)s)" + "New group ID (e.g. +foo:%(localDomain)s)": "New group ID (e.g. +foo:%(localDomain)s)", + "%(serverName)s Matrix ID": "%(serverName)s Matrix ID" }