/** * Logs in a user with a valid email/password combination. * Returns TRUE if the email + password combination matches and the user is activated and not banned. * A status code (LOGIN_ACTIVATING, LOGIN_BANNED or LOGIN_INCORRECT) will be retured in all other situations. * * @access public * @param string $email User email * @param string $password User password * @param boolean $remember (optional) Set a remember me cookie? * @param boolean $force (optional) Login the user without checking the password? * @param boolean $callback (optional) Set additional query parameters * @return boolean|int */ public function login($email, $password, $remember = false, $force = false, $callback = false) { $authenticated = $this->authenticate($email, $password, $force, $callback); if ($authenticated === true) { $this->session->regenerateId(); $this->session->put($this->authKey, $this->user->getToken()); if ($remember === true) { $this->response->signedCookie($this->authKey, $this->user->getToken(), 3600 * 24 * 365, $this->cookieOptions); } return true; } return $authenticated; }
/** * Logs in a user with a valid email/password combination. * Returns TRUE if the email + password combination matches and the user is activated and not banned. * A status code (LOGIN_ACTIVATING, LOGIN_BANNED or LOGIN_INCORRECT, LOGIN_LOCKED) will be retured in all other situations. * * @access public * @param string $identifier User email * @param string $password User password * @param boolean $remember Set a remember me cookie? * @param boolean $force Login the user without checking the password? * @return boolean|int */ public function login($identifier, $password, $remember = false, $force = false) { if (empty($identifier)) { return static::LOGIN_INCORRECT; } $authenticated = $this->authenticate($identifier, $password, $force); if ($authenticated === true) { $this->session->regenerateId(); $this->session->regenerateToken(); $this->session->put($this->authKey, $this->user->getAccessToken()); if ($remember === true) { $this->response->signedCookie($this->authKey, $this->user->getAccessToken(), 3600 * 24 * 365, $this->cookieOptions); } return true; } return $authenticated; }
/** * Adds a session cookie to the response. * * @access protected */ protected function setCookie() { $ttl = $this->cookieTTL === 0 ? 0 : $this->cookieTTL + time(); $this->response->signedCookie($this->cookieName, $this->sessionId, $ttl, $this->cookieOptions); }