mirror of https://github.com/vector-im/riot-web
Make sure error message never lies
Make sure we don't say 'login incorrect' unless the user is actually trying to log inpull/21833/head
parent
bb3a7725db
commit
1f2b023885
|
@ -77,7 +77,7 @@ module.exports = React.createClass({displayName: 'Login',
|
||||||
this._loginLogic.loginViaPassword(username, password).then(function(data) {
|
this._loginLogic.loginViaPassword(username, password).then(function(data) {
|
||||||
self.props.onLoggedIn(data);
|
self.props.onLoggedIn(data);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
self._setStateFromError(error);
|
self._setStateFromError(error, true);
|
||||||
}).finally(function() {
|
}).finally(function() {
|
||||||
self.setState({
|
self.setState({
|
||||||
busy: false
|
busy: false
|
||||||
|
@ -123,7 +123,7 @@ module.exports = React.createClass({displayName: 'Login',
|
||||||
// logins so let's skip that for now).
|
// logins so let's skip that for now).
|
||||||
loginLogic.chooseFlow(0);
|
loginLogic.chooseFlow(0);
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
self._setStateFromError(err);
|
self._setStateFromError(err, false);
|
||||||
}).finally(function() {
|
}).finally(function() {
|
||||||
self.setState({
|
self.setState({
|
||||||
busy: false
|
busy: false
|
||||||
|
@ -143,11 +143,11 @@ module.exports = React.createClass({displayName: 'Login',
|
||||||
return this._loginLogic ? this._loginLogic.getCurrentFlowStep() : null
|
return this._loginLogic ? this._loginLogic.getCurrentFlowStep() : null
|
||||||
},
|
},
|
||||||
|
|
||||||
_setStateFromError: function(err) {
|
_setStateFromError: function(err, isLoginAttempt) {
|
||||||
this.setState({
|
this.setState({
|
||||||
errorText: this._errorTextFromError(err),
|
errorText: this._errorTextFromError(err),
|
||||||
// https://matrix.org/jira/browse/SYN-744
|
// https://matrix.org/jira/browse/SYN-744
|
||||||
loginIncorrect: err.httpStatus == 401 || err.httpStatus == 403
|
loginIncorrect: isLoginAttempt && (err.httpStatus == 401 || err.httpStatus == 403)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue