我是新来php和cakephp,我是从cakephp(http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html)下面的简单身份验证和授权应用程序教程。所有人似乎都很好。Cakephp&用户电子邮件确认
我添加了电子邮件确认以在用户订阅时激活帐户。在教程中,密码使用blowfishpassword hasher。我将它用作确认链接中的一个标记。
,但我似乎无法能够比较与数据库中的密码的链接令牌......
$passwordHasher = new BlowfishPasswordHasher();
$motdepasse = $this->data['Utilisateur']['mot_passe'] = $passwordHasher->hash(
$this->data['Utilisateur']['mot_passe']
);
$link = array('controller'=>'utilisateurs','action'=>'activate',$this->Utilisateur->id
.'-'. $motdepasse);
public function activate($token) {
$token = explode('-',$token);
$user = $this->Utilisateur->find('first',array(
'conditions' => array('id' => $token[0],'Utilisateur.mot_passe' => Security::hash($token[1], 'blowfish', 'Utilisateur.mot_passe'))
));
debug($user);
debug($token[1]);
die();
}
你能帮助我吗?多谢你们!
Wince你正在做手动,你能检查每个哈希版本是什么,并看看它们是否真的不同? – Dave 2014-09-21 15:14:19