Merge branch 'master' into vector
This commit is contained in:
commit
3a6423dd0a
2 changed files with 27 additions and 6 deletions
|
@ -31,6 +31,24 @@ module.exports = React.createClass({
|
||||||
displayName: 'Login',
|
displayName: 'Login',
|
||||||
mixins: [LoginController],
|
mixins: [LoginController],
|
||||||
|
|
||||||
|
getHsUrl: function() {
|
||||||
|
return this.refs.serverConfig.getHsUrl();
|
||||||
|
},
|
||||||
|
|
||||||
|
getIsUrl: function() {
|
||||||
|
return this.refs.serverConfig.getIsUrl();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the form field values for the current login stage
|
||||||
|
*/
|
||||||
|
getFormVals: function() {
|
||||||
|
return {
|
||||||
|
'username': this.refs.user.getDOMNode().value,
|
||||||
|
'password': this.refs.pass.getDOMNode().value
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
componentForStep: function(step) {
|
componentForStep: function(step) {
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case 'choose_hs':
|
case 'choose_hs':
|
||||||
|
|
|
@ -41,12 +41,12 @@ module.exports = {
|
||||||
onHSChosen: function(ev) {
|
onHSChosen: function(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
MatrixClientPeg.replaceUsingUrls(
|
MatrixClientPeg.replaceUsingUrls(
|
||||||
this.refs.serverConfig.getHsUrl(),
|
this.getHsUrl(),
|
||||||
this.refs.serverConfig.getIsUrl()
|
this.getIsUrl()
|
||||||
);
|
);
|
||||||
this.setState({
|
this.setState({
|
||||||
hs_url: this.refs.serverConfig.getHsUrl(),
|
hs_url: this.getHsUrl(),
|
||||||
is_url: this.refs.serverConfig.getIsUrl()
|
is_url: this.getIsUrl()
|
||||||
});
|
});
|
||||||
this.setStep("fetch_stages");
|
this.setStep("fetch_stages");
|
||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
|
@ -69,9 +69,12 @@ module.exports = {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
this.setState({busy: true});
|
this.setState({busy: true});
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
|
var formVals = this.getFormVals();
|
||||||
|
|
||||||
MatrixClientPeg.get().login('m.login.password', {
|
MatrixClientPeg.get().login('m.login.password', {
|
||||||
'user': that.refs.user.getDOMNode().value,
|
'user': formVals.username,
|
||||||
'password': that.refs.pass.getDOMNode().value
|
'password': formVals.password
|
||||||
}).done(function(data) {
|
}).done(function(data) {
|
||||||
// XXX: we assume this means we're logged in, but there could be a next stage
|
// XXX: we assume this means we're logged in, but there could be a next stage
|
||||||
MatrixClientPeg.replace(Matrix.createClient({
|
MatrixClientPeg.replace(Matrix.createClient({
|
||||||
|
|
Loading…
Reference in a new issue