I'm using express-validator for express 3.x -- when the user changes their password or signs up for an new account, they have to enter their password twice.
How would I write a custom validator that will push an error to the error stack in express-validator if the two passwords (two strings) do not match?
Something like this:
req.assert('password1', 'Passwords do not match').isIdentical(password1, password2);
var mappedErrors = req.validationErrors(true);
I found the answer
req.assert('password2', 'Passwords do not match').equals(req.body.password1);
var mappedErrors = req.validationErrors(true);