mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Refactoring to use flashLayout variable when setting flash messages
This commit is contained in:
parent
8d6135a8d1
commit
2484245c68
1 changed files with 11 additions and 3 deletions
|
@ -84,6 +84,14 @@ class AuthComponent extends Object {
|
|||
*/
|
||||
var $ajaxLogin = null;
|
||||
|
||||
/**
|
||||
* The name of the layout element used on Session::setFlash
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $flashLayout = 'default';
|
||||
|
||||
/**
|
||||
* The name of the model that represents users which will be authenticated. Defaults to 'User'.
|
||||
*
|
||||
|
@ -358,13 +366,13 @@ class AuthComponent extends Object {
|
|||
}
|
||||
}
|
||||
|
||||
$this->Session->setFlash($this->loginError, 'default', array(), 'auth');
|
||||
$this->Session->setFlash($this->loginError, $this->flashLayout, array(), 'auth');
|
||||
$controller->data[$model->alias][$this->fields['password']] = null;
|
||||
return false;
|
||||
} else {
|
||||
if (!$this->user()) {
|
||||
if (!$this->RequestHandler->isAjax()) {
|
||||
$this->Session->setFlash($this->authError, 'default', array(), 'auth');
|
||||
$this->Session->setFlash($this->authError, $this->flashLayout, array(), 'auth');
|
||||
if (!empty($controller->params['url']) && count($controller->params['url']) >= 2) {
|
||||
$query = $controller->params['url'];
|
||||
unset($query['url'], $query['ext']);
|
||||
|
@ -428,7 +436,7 @@ class AuthComponent extends Object {
|
|||
return true;
|
||||
}
|
||||
|
||||
$this->Session->setFlash($this->authError, 'default', array(), 'auth');
|
||||
$this->Session->setFlash($this->authError, $this->flashLayout, array(), 'auth');
|
||||
$controller->redirect($controller->referer(), null, true);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue