Nos ez sem segített. A core.php-ben
Configure::write('debug', 2);
van, tehát minden hibaüzenetet kiír.
Az app_controller.php-ben megadom a szükséges dolgokat:
var $components = array('Acl', 'Auth', 'Session', 'Cookie', 'requestHandler');
var $helpers = array ('Html', 'Form', 'Javascript', 'Ajax', 'Session');
function beforeFilter() {
parent::beforeFilter();
$this->L10n = new L10n();
$this->L10n->get('hu');
Configure::write('Config.language', 'hu');
$this->Auth->authorize = 'controller';
$this->Auth->authError = __('Access denied', true);
$this->Auth->loginError = __('The username or password is incorrect!', true);
$this->Auth->logoutRedirect = array('controller' => 'posts', 'action' => 'index');
$this->set('header_footer', $this->Setting->read(null, 1));
}
A users_controller.php:
function beforeFilter() {
parent::beforeFilter();
$this->Auth->fields = array(
'username' => 'email',
'password' => 'password'
);
$this->Auth->allow('registration');
}
function login() {
if(isset($this->params['form']['registration'])) {
$this->redirect(array('action'=>'registration'));
}
if($this->Session->read('Auth.User')) {
$this->Session->setFlash(__('You are logged in!', true));
$this->redirect('/', null, false);
}
}
function logout() {
debug($this->session);
die();
$this->Session->setFlash(__('Good-bye', true));
$this->redirect($this->Auth->logout());
}
Ha kilépés gombra kattintok, ugyan azon az oldalon marad. Ha közvetlenül meghívom a logoutot, akkor is bejelentkezve maradok, mert meg tudok nézni olyan oldalakat, amihez csak bejelentkezve férek hozzá, viszont átdob a kezdőoldalra, de semmi hibaüzenetet nem ír.