Make new login style work

pull/1/head
David Baker 2015-07-16 21:46:39 +01:00
parent d08c47a328
commit 8ccce4d702
1 changed files with 19 additions and 7 deletions

View File

@ -19,6 +19,7 @@ limitations under the License.
var React = require('react'); var React = require('react');
var ComponentBroker = require("../../../../src/ComponentBroker"); var ComponentBroker = require("../../../../src/ComponentBroker");
var MatrixClientPeg = require("../../../../src/MatrixClientPeg");
var ProgressBar = ComponentBroker.get("molecules/ProgressBar"); var ProgressBar = ComponentBroker.get("molecules/ProgressBar");
var Loader = require("react-loader"); var Loader = require("react-loader");
@ -48,7 +49,7 @@ module.exports = React.createClass({
getHsUrl: function() { getHsUrl: function() {
if (this.state.serverConfigVisible) { if (this.state.serverConfigVisible) {
return this.refs.serverConfig.getHsUrl(); return this.customHsUrl;
} else { } else {
return this.DEFAULT_HS_URL; return this.DEFAULT_HS_URL;
} }
@ -56,7 +57,7 @@ module.exports = React.createClass({
getIsUrl: function() { getIsUrl: function() {
if (this.state.serverConfigVisible) { if (this.state.serverConfigVisible) {
return this.refs.serverConfig.getIsUrl(); return this.customIsUrl;
} else { } else {
return this.DEFAULT_IS_URL; return this.DEFAULT_IS_URL;
} }
@ -65,7 +66,7 @@ module.exports = React.createClass({
onServerConfigVisibleChange: function(ev) { onServerConfigVisibleChange: function(ev) {
this.setState({ this.setState({
serverConfigVisible: ev.target.checked serverConfigVisible: ev.target.checked
}); }, this.onHsUrlChanged);
}, },
/** /**
@ -79,12 +80,23 @@ module.exports = React.createClass({
}, },
onHsUrlChanged: function() { onHsUrlChanged: function() {
this.customHsUrl = this.getHsUrl(); this.customHsUrl = this.refs.serverConfig.getHsUrl();
this.customIsUrl = this.getIsUrl(); this.customIsUrl = this.refs.serverConfig.getIsUrl();
if (this.updateHsTimeout) { MatrixClientPeg.replaceUsingUrls(
this.getHsUrl(),
this.getIsUrl()
);
this.setState({
hs_url: this.getHsUrl(),
is_url: this.getIsUrl()
});
// XXX: HSes do not have to offer password auth, so we
// need to update and maybe show a different component
// when a new HS is entered.
/*if (this.updateHsTimeout) {
clearTimeout(this.updateHsTimeout); clearTimeout(this.updateHsTimeout);
} }
/*var self = this; var self = this;
this.updateHsTimeout = setTimeout(function() { this.updateHsTimeout = setTimeout(function() {
self.onHSChosen(); self.onHSChosen();
}, 500);*/ }, 500);*/