@@ -74,14 +74,25 @@ module.exports = React.createClass({
7474 */
7575 getFormVals : function ( ) {
7676 return {
77- 'username' : this . refs . user . getDOMNode ( ) . value ,
78- 'password' : this . refs . pass . getDOMNode ( ) . value
77+ 'username' : this . refs . user . getDOMNode ( ) . value . trim ( ) ,
78+ 'password' : this . refs . pass . getDOMNode ( ) . value . trim ( )
7979 } ;
8080 } ,
8181
8282 onHsUrlChanged : function ( ) {
83- this . customHsUrl = this . refs . serverConfig . getHsUrl ( ) ;
84- this . customIsUrl = this . refs . serverConfig . getIsUrl ( ) ;
83+ var newHsUrl = this . refs . serverConfig . getHsUrl ( ) . trim ( ) ;
84+ var newIsUrl = this . refs . serverConfig . getIsUrl ( ) . trim ( ) ;
85+
86+ if ( newHsUrl == this . customHsUrl &&
87+ newIsUrl == this . customIsUrl )
88+ {
89+ return ;
90+ }
91+ else {
92+ this . customHsUrl = newHsUrl ;
93+ this . customIsUrl = newIsUrl ;
94+ }
95+
8596 MatrixClientPeg . replaceUsingUrls (
8697 this . getHsUrl ( ) ,
8798 this . getIsUrl ( )
@@ -93,23 +104,24 @@ module.exports = React.createClass({
93104 // XXX: HSes do not have to offer password auth, so we
94105 // need to update and maybe show a different component
95106 // when a new HS is entered.
96- /* if (this.updateHsTimeout) {
107+ if ( this . updateHsTimeout ) {
97108 clearTimeout ( this . updateHsTimeout ) ;
98109 }
99110 var self = this ;
100111 this . updateHsTimeout = setTimeout ( function ( ) {
101112 self . onHSChosen ( ) ;
102- }, 500);*/
113+ } , 1000 ) ;
103114 } ,
104115
105116 componentForStep : function ( step ) {
106117 switch ( step ) {
107118 case 'choose_hs' :
119+ case 'fetch_stages' :
108120 var serverConfigStyle = { } ;
109121 serverConfigStyle . display = this . state . serverConfigVisible ? 'block' : 'none' ;
110122 return (
111123 < div >
112- < input className = "mx_Login_checkbox" id = "advanced" type = "checkbox" value = { this . state . serverConfigVisible } onChange = { this . onServerConfigVisibleChange } />
124+ < input className = "mx_Login_checkbox" id = "advanced" type = "checkbox" checked = { this . state . serverConfigVisible } onChange = { this . onServerConfigVisibleChange } />
113125 < label className = "mx_Login_label" htmlFor = "advanced" > Use custom server options (advanced)</ label >
114126 < div style = { serverConfigStyle } >
115127 < ServerConfig ref = "serverConfig"
@@ -126,7 +138,7 @@ module.exports = React.createClass({
126138 < form onSubmit = { this . onUserPassEntered } >
127139 < input className = "mx_Login_field" ref = "user" type = "text" value = { this . state . username } onChange = { this . onUsernameChanged } placeholder = "Email or user name" /> < br />
128140 < input className = "mx_Login_field" ref = "pass" type = "password" value = { this . state . password } onChange = { this . onPasswordChanged } placeholder = "Password" /> < br />
129- { this . componentForStep ( 'choose_hs' ) }
141+ { this . componentForStep ( 'choose_hs' ) }
130142 < input className = "mx_Login_submit" type = "submit" value = "Log in" />
131143 </ form >
132144 </ div >
@@ -143,20 +155,18 @@ module.exports = React.createClass({
143155 } ,
144156
145157 loginContent : function ( ) {
146- if ( this . state . busy ) {
147- return (
148- < Loader />
149- ) ;
150- } else {
151- return (
152- < div >
153- < h2 > Sign in</ h2 >
154- { this . componentForStep ( this . state . step ) }
155- < div className = "mx_Login_error" > { this . state . errorText } </ div >
156- < a className = "mx_Login_create" onClick = { this . showRegister } href = "#" > Create a new account</ a >
158+ var loader = this . state . busy ? < div className = "mx_Login_loader" > < Loader /> </ div > : null ;
159+ return (
160+ < div >
161+ < h2 > Sign in</ h2 >
162+ { this . componentForStep ( this . state . step ) }
163+ < div className = "mx_Login_error" >
164+ { loader }
165+ { this . state . errorText }
157166 </ div >
158- ) ;
159- }
167+ < a className = "mx_Login_create" onClick = { this . showRegister } href = "#" > Create a new account</ a >
168+ </ div >
169+ ) ;
160170 } ,
161171
162172 render : function ( ) {
0 commit comments