脚本宝典收集整理的这篇文章主要介绍了hash – CakePHP 3.0 – 在更改密码时将数据库密码与旧密码进行比较,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
请帮帮我.
提前致谢,
乱斗
SRC /型号/表/ UsersTable.PHP
$validator ->notEmpty('current_password') ->add('current_password','custom',[ 'rule' => function($value,$context) { $query = $this->find() ->where([ 'id' => $context['data']['id'] ]) ->First(); $data = $query->toArray(); return (new DefaultPasswordHasher)->check($value,$data['password']); },'message' => 'Current password is incorrect!' ]);
以上是脚本宝典为你收集整理的hash – CakePHP 3.0 – 在更改密码时将数据库密码与旧密码进行比较全部内容,希望文章能够帮你解决hash – CakePHP 3.0 – 在更改密码时将数据库密码与旧密码进行比较所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。