Handle no-auth-flow error from js-sdk
This commit is contained in:
parent
2c1ac29d30
commit
d292a627d8
2 changed files with 12 additions and 2 deletions
|
@ -107,7 +107,6 @@ export default React.createClass({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const msg = error.message || error.toString();
|
|
||||||
this.setState({
|
this.setState({
|
||||||
errorText: msg
|
errorText: msg
|
||||||
});
|
});
|
||||||
|
|
|
@ -155,10 +155,21 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
_onUIAuthFinished: function(success, response, extra) {
|
_onUIAuthFinished: function(success, response, extra) {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
let msg = response.message || response.toString();
|
||||||
|
// can we give a better error message?
|
||||||
|
if (response.required_stages && response.required_stages.indexOf('m.login.msisdn') > -1) {
|
||||||
|
let msisdn_available = false;
|
||||||
|
for (const flow of response.available_flows) {
|
||||||
|
msisdn_available |= flow.stages.indexOf('m.login.msisdn') > -1;
|
||||||
|
}
|
||||||
|
if (!msisdn_available) {
|
||||||
|
msg = "This server does not support authentication with a phone number";
|
||||||
|
}
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
busy: false,
|
busy: false,
|
||||||
doingUIAuth: false,
|
doingUIAuth: false,
|
||||||
errorText: response.message || response.toString(),
|
errorText: msg,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue