mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 19:42:41 +00:00
Avoid unnecessary overhead if user record already available from session.
This commit is contained in:
parent
06a5c509c0
commit
3db632732c
2 changed files with 7 additions and 5 deletions
|
@ -667,6 +667,12 @@ class AuthComponent extends Component {
|
|||
* @return boolean true if a user can be found, false if one cannot.
|
||||
*/
|
||||
protected function _getUser() {
|
||||
$user = $this->user();
|
||||
if ($user) {
|
||||
$this->Session->delete('Auth.redirect');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (empty($this->_authenticateObjects)) {
|
||||
$this->constructAuthenticate();
|
||||
}
|
||||
|
@ -678,11 +684,6 @@ class AuthComponent extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
$user = $this->user();
|
||||
if ($user) {
|
||||
$this->Session->delete('Auth.redirect');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue