0
작동하지 않는 나는이 두 테이블CakePHP의 2 : 4 : Authcomponent이
1) 2) 내가 모델에서의 AppController
public $components = array('Session','RequestHandler','Paginator'=>array('limit'=>4),'Auth'=>array(
'loginAction' => array(
'controller' => 'aucusers',
'action' => 'login'
),
'loginRedirect' => array('controller' => 'aucusers','action' => 'add'),
'logoutRedirect' => array('controller' => 'aucusers','action' => 'add'),
'authError'=>'You can not access this page!!',
));
public function beforeFilter() {
$this->set('logged_in', $this->Auth->loggedIn());
$this->set('current_user',$this->Auth->user());
parent::beforeFilter();
$this->Paginator->settings = array(
'limit'=>4
);
에서 울부 짖는 코드를 사용 사용 인증 구성 요소의
을 user_types aucusers 해시 비밀 번호에 대해 내가 사용했습니다
public function beforeSave($options = array()) {
if (isset($this->data[$this->alias]['password'])) {
$passwordHasher = new SimplePasswordHasher();
$this->data[$this->alias]['password'] = $passwordHasher->hash(
$this->data[$this->alias]['password']
);
}
return true;
}
aucusers co ntroller 나는
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirect());
}
$this->Session->setFlash(__('Invalid username or password, try again'));
}
}
public function logout() {
return $this->redirect($this->Auth->logout());
}
이 후
나는 그것이 나에게
잘못된 사용자 이름이나 암호를 보여주는, 로그인하려고 오전 user.But을 한
$this->Auth->allow()
, 다시 시도 추가합니다.
더러운 트릭에서
이 올바르게 설정되어 - core.php 설정 디버그 2에 다음이에서 사용되는 해시를 볼 당신이 로그인을 시도 (그리고 실패) 때 SQL 덤프. 이것을 데이터베이스의 해시와 비교하십시오. 똑같은가요? – robmcvey