Avoid unnecessary overhead if user record already available from session.

This commit is contained in:
ADmad 2013-04-23 01:35:04 +05:30
parent 06a5c509c0
commit 3db632732c
2 changed files with 7 additions and 5 deletions

View file

@ -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;
}