You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used this template for my capstone and found a solution for this. I was about to open an issue when I found yours.
controllers/users.js
const signup = (req, res, next) => {
let credentials = req.body.credentials;
let user = { email: credentials.email, password: credentials.password};
getToken()
.then(token => user.token = token)
// needed to add ternary to ensure new and old passwords match before saving new user
.then(() =>
req.body.credentials.password !== req.body.credentials.password_confirmation ?
Promise.reject(new HttpError(404)) : new User(user).save())
.then(user =>
res.status(201).json({ user }))
.catch(makeErrorHandler(res, next));
};
Currently it doesn't check if the password and password confirmation match.
The text was updated successfully, but these errors were encountered: