Exemplo n.º 1
0
 /**
  * Check whether a user is valid (is authenticated)?
  *
  * @return bool
  */
 public function isValid()
 {
     if ($this->userInstance !== null && $this->userInstance->offsetGet('activated') == 2) {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Write identification Cookie
  *
  * @param AbstractUser $user
  * @param bool $remember
  */
 private function writeCookie(AbstractUser $user, $remember)
 {
     if ($remember) {
         $cookie = new SetCookie($this->facade->domain, $user->offsetGet('id') . '::' . $user->offsetGet('token', true), time() + 3600 * 24 * 31, '/');
         $this->response->getHeaders()->addHeader($cookie);
         $this->response->send();
     }
 }
Exemplo n.º 3
0
 /**
  * Update attributes
  *
  * @param AbstractUser $user
  */
 protected function updateAttributes(AbstractUser $user)
 {
     $user->offsetSet('ip', $this->network->getClientIp());
     $user->offsetSet('userAgent', $this->network->getUserAgent());
     if ($user->offsetGet('lastVisit') < time() - 90) {
         $user->offsetSet('lastVisit', time());
     }
 }
Exemplo n.º 4
0
 /**
  * Update attributes
  *
  * @param AbstractUser $user
  */
 public static function updateAttributes(AbstractUser $user, Request $request)
 {
     $user->offsetSet('ip', $request->getClientIp());
     $user->offsetSet('user_agent', $request->getUserAgent());
     if ($user->offsetGet('last_visit') < time() - 90) {
         $user->offsetSet('last_visit', time());
     }
 }
Exemplo n.º 5
0
 /**
  * Write identification Cookie
  *
  * @param AbstractUser $user
  * @param bool         $remember
  */
 private function writeCookie(AbstractUser $user, $remember)
 {
     if ($remember) {
         $this->response->headers->setCookie(new Cookie($this->facade->domain, $user->offsetGet('id') . '::' . $user->offsetGet('token', true), time() + 3600 * 24 * 31));
         $this->response->send();
     }
 }