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

Commit 92be3af

Browse files
committed
Make it clearer which HS you're logging into
Otherwise there's no indication without clicking 'custom server'
1 parent 2ba0a80 commit 92be3af

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

src/components/structures/login/Login.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ module.exports = React.createClass({
290290
onPhoneNumberChanged={this.onPhoneNumberChanged}
291291
onForgotPasswordClick={this.props.onForgotPasswordClick}
292292
loginIncorrect={this.state.loginIncorrect}
293+
hsUrl={this.state.enteredHomeserverUrl}
293294
/>
294295
);
295296
case 'm.login.cas':

src/components/views/elements/Dropdown.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ class MenuOption extends React.Component {
2626
this._onClick = this._onClick.bind(this);
2727
}
2828

29+
getDefaultProps() {
30+
return {
31+
disabled: false,
32+
}
33+
}
34+
2935
_onMouseEnter() {
3036
this.props.onMouseEnter(this.props.dropdownKey);
3137
}
@@ -153,6 +159,8 @@ export default class Dropdown extends React.Component {
153159
}
154160

155161
_onInputClick(ev) {
162+
if (this.props.disabled) return;
163+
156164
if (!this.state.expanded) {
157165
this.setState({
158166
expanded: true,
@@ -329,4 +337,6 @@ Dropdown.propTypes = {
329337
// in the dropped-down menu.
330338
getShortOption: React.PropTypes.func,
331339
value: React.PropTypes.string,
340+
// negative for consistency with HTML
341+
disabled: React.PropTypes.bool,
332342
}

src/components/views/login/PasswordLogin.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,17 @@ class PasswordLogin extends React.Component {
186186

187187
const loginField = this.renderLoginField(this.state.loginType);
188188

189+
let matrixIdText = '';
190+
if (this.props.hsUrl) {
191+
try {
192+
const parsedHsUrl = new URL(this.props.hsUrl);
193+
matrixIdText = _t('%(serverName)s Matrix ID', {serverName: parsedHsUrl.hostname});
194+
} catch (e) {
195+
console.log(e);
196+
// pass
197+
}
198+
}
199+
189200
return (
190201
<div>
191202
<form onSubmit={this.onSubmitForm}>
@@ -194,8 +205,9 @@ class PasswordLogin extends React.Component {
194205
<Dropdown
195206
className="mx_Login_type_dropdown"
196207
value={this.state.loginType}
208+
disabled={matrixIdText === ''}
197209
onOptionChange={this.onLoginTypeChange}>
198-
<span key={PasswordLogin.LOGIN_FIELD_MXID}>{ _t('my Matrix ID') }</span>
210+
<span key={PasswordLogin.LOGIN_FIELD_MXID}>{matrixIdText}</span>
199211
<span key={PasswordLogin.LOGIN_FIELD_EMAIL}>{ _t('Email address') }</span>
200212
<span key={PasswordLogin.LOGIN_FIELD_PHONE}>{ _t('Phone') }</span>
201213
</Dropdown>

src/i18n/strings/en_EN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,5 +906,6 @@
906906
"Related Groups": "Related Groups",
907907
"Related groups for this room:": "Related groups for this room:",
908908
"This room has no related groups": "This room has no related groups",
909-
"New group ID (e.g. +foo:%(localDomain)s)": "New group ID (e.g. +foo:%(localDomain)s)"
909+
"New group ID (e.g. +foo:%(localDomain)s)": "New group ID (e.g. +foo:%(localDomain)s)",
910+
"%(serverName)s Matrix ID": "%(serverName)s Matrix ID"
910911
}

0 commit comments

Comments
 (0)