快速验证器中的“等于”如何工作?

问题描述

我必须验证两个字段是否相等。在这种情况下,两个密码是相同的。问题是来自 express-validator 的“equals”不起作用。

这是代码

app.post('/register',[
 isNotLogged,check('email','The email must be a valid one').isEmail(),check('nickname','The nickname must be filled').notEmpty(),check('password','The password must contain minimum eight characters,at least one letter and one number')
    .matches("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$"),//This is not working
 check('passwordConfirm','The passwords must match').equals('password'),validateResults
],register)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)