/** * @BindingModels AdminLoginBindingModel */ public function login(AdminLoginBindingModel $bindingModel) { if ($bindingModel) { $data = new DbAppManipulation(); $adminId = $data->login($bindingModel->getUsername(), $bindingModel->getPassword()); if ($adminId) { $this->session->adminId = $adminId; $this->session->csrf = uniqid(); } else { throw new \Exception('Cannot login user'); } header('Location: /admin/index/home'); $this->session->csrf = uniqid(); } }