На мой взгляд, у меня есть:
<?php echo $this->Session->flash(); ?>
В моем UsersController у меня есть:
public function login() {
$this->Session->delete('Flash.auth');
$this->Session->delete('Message.flash');
$this->Session->delete('auth');
$this->Session->delete('Message.auth');
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect(array('controller' => 'users', 'action' => 'index')));
} else {
$this->Session->setFlash('Invalid username or password, please try again', null, null);
}
}
public function logout() {
$this->defaultTextView();
return $this->redirect($this->Auth->redirect(array('controller' => 'users', 'action' => 'login')));
}
function index($id = null) {
$this->Session->delete('Message.flash');
$this->Session->destroy('Message.flash');
$user_id_sess = $this->Session->read('Auth.User.id');
$this->defaultAdminViewHere();
$this->set('user_id_sess', $this->Session->read('Auth.User.id'));
$this->User->id = $id;
$this->set('user', $this->User->read());
}
Проблема в том, что мое флеш-сообщение сохраняется даже после успешного входа в систему.
pr ($ this-> Session-> read ());уступил:
Array
(
[Config] => Array
(
[userAgent] => adcb84540c454620867cea3249a69ca1
[time] => 1544388026
[countdown] => 10
)
[Message] => Array
(
[flash] => Array
(
[message] => Invalid username or password, please try again
[element] => default
[params] => Array
(
)
)
)
)
Вынужден добавить больше деталей, так как мой пост в основном кодовый.Не отображается сообщение об ошибке, если я использую неправильный пароль.После выхода из системы отображается сообщение об ошибке.