问题描述
我正在尝试使用确认密码验证我的密码,但它似乎不适用于 express-validator:
这是我尝试使用的代码:
app.post('/sign-up',body('password').custom((value,{ req }) => {
if (value !== req.body.confirmPassword) {
throw new Error('Password confirmation is incorrect');
}
}),(req,res) => {
const user = new User({
username: req.body.username,password: req.body.password,confirmPassword: req.body.confirmPassword
})
user.save(err => {
if (err) {
return next(err);
};
res.redirect("/");
});
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)