You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
Make sure error message never lies
Make sure we don't say 'login incorrect' unless the user is actually trying to log in
This commit is contained in:
@@ -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)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user