This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -290,6 +290,7 @@ module.exports = React.createClass({
290
290
onPhoneNumberChanged = { this . onPhoneNumberChanged }
291
291
onForgotPasswordClick = { this . props . onForgotPasswordClick }
292
292
loginIncorrect = { this . state . loginIncorrect }
293
+ hsUrl = { this . state . enteredHomeserverUrl }
293
294
/>
294
295
) ;
295
296
case 'm.login.cas' :
Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ class MenuOption extends React.Component {
26
26
this . _onClick = this . _onClick . bind ( this ) ;
27
27
}
28
28
29
+ getDefaultProps ( ) {
30
+ return {
31
+ disabled : false ,
32
+ }
33
+ }
34
+
29
35
_onMouseEnter ( ) {
30
36
this . props . onMouseEnter ( this . props . dropdownKey ) ;
31
37
}
@@ -153,6 +159,8 @@ export default class Dropdown extends React.Component {
153
159
}
154
160
155
161
_onInputClick ( ev ) {
162
+ if ( this . props . disabled ) return ;
163
+
156
164
if ( ! this . state . expanded ) {
157
165
this . setState ( {
158
166
expanded : true ,
@@ -329,4 +337,6 @@ Dropdown.propTypes = {
329
337
// in the dropped-down menu.
330
338
getShortOption : React . PropTypes . func ,
331
339
value : React . PropTypes . string ,
340
+ // negative for consistency with HTML
341
+ disabled : React . PropTypes . bool ,
332
342
}
Original file line number Diff line number Diff line change @@ -186,6 +186,17 @@ class PasswordLogin extends React.Component {
186
186
187
187
const loginField = this . renderLoginField ( this . state . loginType ) ;
188
188
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
+
189
200
return (
190
201
< div >
191
202
< form onSubmit = { this . onSubmitForm } >
@@ -194,8 +205,9 @@ class PasswordLogin extends React.Component {
194
205
< Dropdown
195
206
className = "mx_Login_type_dropdown"
196
207
value = { this . state . loginType }
208
+ disabled = { matrixIdText === '' }
197
209
onOptionChange = { this . onLoginTypeChange } >
198
- < span key = { PasswordLogin . LOGIN_FIELD_MXID } > { _t ( 'my Matrix ID' ) } </ span >
210
+ < span key = { PasswordLogin . LOGIN_FIELD_MXID } > { matrixIdText } </ span >
199
211
< span key = { PasswordLogin . LOGIN_FIELD_EMAIL } > { _t ( 'Email address' ) } </ span >
200
212
< span key = { PasswordLogin . LOGIN_FIELD_PHONE } > { _t ( 'Phone' ) } </ span >
201
213
</ Dropdown >
Original file line number Diff line number Diff line change 906
906
"Related Groups" : " Related Groups" ,
907
907
"Related groups for this room:" : " Related groups for this room:" ,
908
908
"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"
910
911
}
You can’t perform that action at this time.
0 commit comments