I already have an account
@@ -256,11 +260,13 @@ module.exports = React.createClass({
render: function() {
var LoginHeader = sdk.getComponent('login.LoginHeader');
+ var LoginFooter = sdk.getComponent('login.LoginFooter');
return (
{this._getRegisterContentJsx()}
+
);
diff --git a/src/components/views/login/CustomServerDialog.js b/src/components/views/login/CustomServerDialog.js
index dc6a49abd6..92b6c54ac1 100644
--- a/src/components/views/login/CustomServerDialog.js
+++ b/src/components/views/login/CustomServerDialog.js
@@ -31,12 +31,11 @@ module.exports = React.createClass({
servers by specifying a different Home server URL.
This allows you to use this app with an existing Matrix account on
- a different Home server.
+ a different home server.
- You can also set a custom Identity server but this will affect
- people's ability to find you if you use a server in a group other
- than the main Matrix.org group.
+ You can also set a custom identity server but this will typically prevent
+ interaction with users based on email address.
diff --git a/src/components/views/login/PasswordLogin.js b/src/components/views/login/PasswordLogin.js
index a8751da1a7..c5474f60c1 100644
--- a/src/components/views/login/PasswordLogin.js
+++ b/src/components/views/login/PasswordLogin.js
@@ -23,13 +23,26 @@ var ReactDOM = require('react-dom');
module.exports = React.createClass({displayName: 'PasswordLogin',
propTypes: {
onSubmit: React.PropTypes.func.isRequired, // fn(username, password)
- onForgotPasswordClick: React.PropTypes.func // fn()
+ onForgotPasswordClick: React.PropTypes.func, // fn()
+ initialUsername: React.PropTypes.string,
+ initialPassword: React.PropTypes.string,
+ onUsernameChanged: React.PropTypes.func,
+ onPasswordChanged: React.PropTypes.func,
+ },
+
+ getDefaultProps: function() {
+ return {
+ onUsernameChanged: function() {},
+ onPasswordChanged: function() {},
+ initialUsername: "",
+ initialPassword: "",
+ };
},
getInitialState: function() {
return {
- username: "",
- password: ""
+ username: this.props.initialUsername,
+ password: this.props.initialPassword,
};
},
@@ -40,10 +53,12 @@ module.exports = React.createClass({displayName: 'PasswordLogin',
onUsernameChanged: function(ev) {
this.setState({username: ev.target.value});
+ this.props.onUsernameChanged(ev.target.value);
},
onPasswordChanged: function(ev) {
this.setState({password: ev.target.value});
+ this.props.onPasswordChanged(ev.target.value);
},
render: function() {
diff --git a/src/components/views/login/ServerConfig.js b/src/components/views/login/ServerConfig.js
index fe80a0d61b..634bb4aac2 100644
--- a/src/components/views/login/ServerConfig.js
+++ b/src/components/views/login/ServerConfig.js
@@ -29,8 +29,21 @@ module.exports = React.createClass({
propTypes: {
onHsUrlChanged: React.PropTypes.func,
onIsUrlChanged: React.PropTypes.func,
- defaultHsUrl: React.PropTypes.string,
- defaultIsUrl: React.PropTypes.string,
+
+ // default URLs are defined in config.json (or the hardcoded defaults)
+ // they are used if the user has not overridden them with a custom URL.
+ // In other words, if the custom URL is blank, the default is used.
+ defaultHsUrl: React.PropTypes.string, // e.g. https://matrix.org
+ defaultIsUrl: React.PropTypes.string, // e.g. https://vector.im
+
+ // custom URLs are explicitly provided by the user and override the
+ // default URLs. The user enters them via the component's input fields,
+ // which is reflected on these properties whenever on..UrlChanged fires.
+ // They are persisted in localStorage by MatrixClientPeg, and so can
+ // override the default URLs when the component initially loads.
+ customHsUrl: React.PropTypes.string,
+ customIsUrl: React.PropTypes.string,
+
withToggleButton: React.PropTypes.bool,
delayTimeMs: React.PropTypes.number // time to wait before invoking onChanged
},
@@ -39,6 +52,8 @@ module.exports = React.createClass({
return {
onHsUrlChanged: function() {},
onIsUrlChanged: function() {},
+ customHsUrl: "",
+ customIsUrl: "",
withToggleButton: false,
delayTimeMs: 0
};
@@ -46,19 +61,21 @@ module.exports = React.createClass({
getInitialState: function() {
return {
- hs_url: this.props.defaultHsUrl,
- is_url: this.props.defaultIsUrl,
- original_hs_url: this.props.defaultHsUrl,
- original_is_url: this.props.defaultIsUrl,
- // no toggle button = show, toggle button = hide
- configVisible: !this.props.withToggleButton
+ hs_url: this.props.customHsUrl,
+ is_url: this.props.customIsUrl,
+ // if withToggleButton is false, then show the config all the time given we have no way otherwise of making it visible
+ configVisible: !this.props.withToggleButton ||
+ (this.props.customHsUrl !== this.props.defaultHsUrl) ||
+ (this.props.customIsUrl !== this.props.defaultIsUrl)
}
},
onHomeserverChanged: function(ev) {
this.setState({hs_url: ev.target.value}, function() {
this._hsTimeoutId = this._waitThenInvoke(this._hsTimeoutId, function() {
- this.props.onHsUrlChanged(this.state.hs_url.replace(/\/$/, ""));
+ var hsUrl = this.state.hs_url.trim().replace(/\/$/, "");
+ if (hsUrl === "") hsUrl = this.props.defaultHsUrl;
+ this.props.onHsUrlChanged(hsUrl);
});
});
},
@@ -66,7 +83,9 @@ module.exports = React.createClass({
onIdentityServerChanged: function(ev) {
this.setState({is_url: ev.target.value}, function() {
this._isTimeoutId = this._waitThenInvoke(this._isTimeoutId, function() {
- this.props.onIsUrlChanged(this.state.is_url.replace(/\/$/, ""));
+ var isUrl = this.state.is_url.trim().replace(/\/$/, "");
+ if (isUrl === "") isUrl = this.props.defaultIsUrl;
+ this.props.onIsUrlChanged(isUrl);
});
});
},
@@ -78,18 +97,18 @@ module.exports = React.createClass({
return setTimeout(fn.bind(this), this.props.delayTimeMs);
},
- getHsUrl: function() {
- return this.state.hs_url;
- },
-
- getIsUrl: function() {
- return this.state.is_url;
- },
-
- onServerConfigVisibleChange: function(ev) {
+ onServerConfigVisibleChange: function(visible, ev) {
this.setState({
- configVisible: ev.target.checked
+ configVisible: visible
});
+ if (!visible) {
+ this.props.onHsUrlChanged(this.props.defaultHsUrl);
+ this.props.onIsUrlChanged(this.props.defaultIsUrl);
+ }
+ else {
+ this.props.onHsUrlChanged(this.state.hs_url);
+ this.props.onIsUrlChanged(this.state.is_url);
+ }
},
showHelpPopup: function() {
@@ -104,12 +123,19 @@ module.exports = React.createClass({
var toggleButton;
if (this.props.withToggleButton) {
toggleButton = (
-