/** * Log the user in from the remember me cookie * * @return mixed User object if logged in correctly from the cookie, or null otherwise */ private function _loginFromCookie() { if (isset($_COOKIE['remember_token'])) { // Find user that has the token set (the token is hashed in the database) $user = User::findByRememberToken(sha1($_COOKIE['remember_token'])); if ($user !== null) { $this->_loginUser($user); return $user; } } }