public function initialize() { parent::initialize(); $this->loadComponent('RequestHandler'); $this->loadComponent('Flash'); $this->loadComponent('Csrf'); $this->loadComponent('Security'); $this->loadComponent('Paginator'); $this->loadComponent('Cookie'); $this->loadComponent('Auth', ['authenticate' => ['Form' => ['fields' => ['username' => 'email']], 'Cookie']]); SettingsData::initialize(); SettingsData::getAll(); $this->Cookie->configKey('CookieAuth', ['expires' => Configure::read('security.cookieAuthDuration'), 'httpOnly' => true]); if (SettingsData::get('debug') == true) { Cache::disable(); } EventDispatcher::dispatch('Settings.init', $this); }