mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge branch 'email_login'
This commit is contained in:
commit
19d350e876
@ -71,10 +71,17 @@ module.exports = {
|
|||||||
|
|
||||||
var formVals = this.getFormVals();
|
var formVals = this.getFormVals();
|
||||||
|
|
||||||
MatrixClientPeg.get().login('m.login.password', {
|
var loginParams = {
|
||||||
'user': formVals.username,
|
password: formVals.password
|
||||||
'password': formVals.password
|
};
|
||||||
}).done(function(data) {
|
if (formVals.username.indexOf('@') > 0) {
|
||||||
|
loginParams.medium = 'email';
|
||||||
|
loginParams.address = formVals.username;
|
||||||
|
} else {
|
||||||
|
loginParams.user = formVals.username;
|
||||||
|
}
|
||||||
|
|
||||||
|
MatrixClientPeg.get().login('m.login.password', loginParams).done(function(data) {
|
||||||
MatrixClientPeg.replaceUsingAccessToken(
|
MatrixClientPeg.replaceUsingAccessToken(
|
||||||
self.state.hs_url, self.state.is_url,
|
self.state.hs_url, self.state.is_url,
|
||||||
data.user_id, data.access_token
|
data.user_id, data.access_token
|
||||||
@ -84,7 +91,11 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
self.setStep("stage_m.login.password");
|
self.setStep("stage_m.login.password");
|
||||||
|
if (error.httpStatus == 400 && loginParams.medium) {
|
||||||
|
self.setState({errorText: 'This Home Server does not support login using email address.'});
|
||||||
|
} else {
|
||||||
self.setState({errorText: 'Login failed.'});
|
self.setState({errorText: 'Login failed.'});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user