Example #1
0
 /**
  * Unsets the cookie token
  *
  * @param integer $userId
  * @return bool
  */
 public function destroyToken($userId = NULL)
 {
     $config = $this->getService('config');
     $cookies = $this->getService('cookies');
     $auth = $this->getService('auth');
     $userId = $userId ? $userId : $auth->getUserId();
     $setting = \Db\Sql\Settings::get($userId, 'user', $config->settings->cookieToken, ['first' => TRUE]);
     return $setting && $setting->delete() && $cookies->get('token')->delete();
 }