dongxun7301
2016-08-12 07:57
浏览 58
已采纳

如何使用散列来确认密码验证cakephp

I'm using cakephp 2.xx, I want to hashing password with sha256 before it going to database, before it I wanna make validation value password in my form input, validation which check password input and re-confirm password is match, if In my controller, when form catch validation, the password automatically hash

if ($this->request->data['Driver']['password'] != $this->request->data['Driver']['confirm_password']) {
      $this->request->data['Driver']['password'] = hash('sha256',$this->request->data['Driver']['password']);
}

necessarily, the password hash when form no catch validate at all, so how can I make validation in my model ?

Thanks In Advance.

图片转代码服务由CSDN问答提供 功能建议

我正在使用cakephp 2.xx,我想在进入数据库之前用sha256散列密码, beforefore 我想在我的表单输入中验证值密码,检查密码输入的验证和重新确认密码匹配,如果在我的控制器中,当表单捕获验证时,密码自动散列</ p>

   if($ this-&gt; request-&gt; data ['Driver'] ['password']!= $ this-&gt; request-&gt; data ['Driver'] ['confirm_password']){\  n $ this-&gt; request-&gt; data ['Driver'] ['password'] = hash('sha256',$ this-&gt; request-&gt; data ['Driver'] ['password']);  
} 
 </ code> </ pre> 
 
 

必然,表单中没有catch的密码哈希验证,那么如何在我的模型中进行验证? </ p>

先谢谢。</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题