【发布时间】:2017-11-21 05:05:54
【问题描述】:
这段代码是用validation.js编写的,用于动态验证所有laravel更改密码表单
$.validator.addMethod("matchp", function(value, element)
{
var dbpass = $("#old").val();
// #old value is fetch from database in type=hidden in frontend and its in bcrypt format.
var txtpass = bcrypt($("#oldpass").val());
// #oldpass value is fetch from frontend its user value and it sholud convert in bcrypt format.
// So that we can compare it to verify the old password while changing the old password.
// Check for equality with the password inputs
if (dbpass != txtpass ) {
return false;
} else {
return true;
}
}, "Your Passwords Must Match");
【问题讨论】:
-
有什么问题?
-
它不起作用,因为我在 jquery 验证文件中使用 bcrypt()
标签: javascript jquery laravel validation bcrypt