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:
Cassie Tarakajian 2019-09-06 13:30:06 -04:00 committed by GitHub
parent 2de215356b
commit a155e7638d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -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
});
}

View File

@ -81,9 +81,9 @@ function mapDispatchToProps() {
LoginView.propTypes = {
previousPath: PropTypes.string.isRequired,
user: {
user: PropTypes.shape({
authenticated: PropTypes.bool
}
})
};
LoginView.defaultProps = {

View File

@ -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) => {