我是新來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