re #1153: fix bug in which login form was in invalid state if user had entered username or password incorrectly on the first try (#1155)
This commit is contained in:
parent
2de215356b
commit
a155e7638d
3 changed files with 5 additions and 6 deletions
|
@ -64,9 +64,8 @@ export function validateAndLoginUser(previousPath, formProps, dispatch) {
|
|||
browserHistory.push(previousPath);
|
||||
resolve();
|
||||
})
|
||||
.catch((response) => {
|
||||
reject({ password: response.data.message, _error: 'Login failed!' }); // eslint-disable-line
|
||||
});
|
||||
.catch(error =>
|
||||
reject({ password: error.response.data.message, _error: 'Login failed!' })); // eslint-disable-line
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -81,9 +81,9 @@ function mapDispatchToProps() {
|
|||
|
||||
LoginView.propTypes = {
|
||||
previousPath: PropTypes.string.isRequired,
|
||||
user: {
|
||||
user: PropTypes.shape({
|
||||
authenticated: PropTypes.bool
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
LoginView.defaultProps = {
|
||||
|
|
|
@ -4,7 +4,7 @@ export function createSession(req, res, next) {
|
|||
passport.authenticate('local', (err, user) => { // eslint-disable-line consistent-return
|
||||
if (err) { return next(err); }
|
||||
if (!user) {
|
||||
return res.status(401).send({ message: 'Invalid username or password.' });
|
||||
return res.status(401).json({ message: 'Invalid username or password.' });
|
||||
}
|
||||
|
||||
req.logIn(user, (innerErr) => {
|
||||
|
|
Loading…
Reference in a new issue