我试图断言 2 个密码匹配:
app.post('/users/signup', [
check('email', 'email is not valid')
.isEmail()
.trim(),
check('password')
.isLength({ min: 4 })
.withMessage('password must be at least 4 characters')
.equals('passwordConfirmation'),
], (req, res) => {
...
我正在使用equals
,但它正在检查是否password
实际上等于字符串'passwordConfirmation'
而不是值req.body.passwordConfirmation