/** * Validates user credentials * * @return TRUE - if validation passed, and FALSE - otherwise */ public function validate($uniqueId = false) { if (!$uniqueId) { $uniqueId = $this->getUniqueId(); } return AdminsManager::getInstance()->validate($this->getId(), $uniqueId); }
public function service() { $login = $this->secure($_REQUEST['login']); $password = $this->secure($_REQUEST['password']); $adminsManager = AdminsManager::getInstance(); $adminDto = $adminsManager->getByLoginPassword($login, $password); if ($adminDto) { $adminUser = new AdminUser($adminDto->getId()); $adminUser->setUniqueId($adminDto->getHash()); $this->sessionManager->setUser($adminUser, true, true); } else { $_SESSION['error_message'] = 'Wrong Login/Password!'; $this->redirect('admin/login'); } $this->redirect('admin'); }
public function getCustomer() { if (!$this->customer) { if ($this->getUserLevel() != UserGroups::$GUEST) { $userId = $this->getUserId(); if ($this->getUserLevel() == UserGroups::$ADMIN) { $adminsManager = AdminsManager::getInstance(); $this->customer = $adminsManager->selectByPK($userId); } else { if ($this->getUserLevel() == UserGroups::$CARWASH) { $carwashManager = CarwashManager::getInstance(); $this->customer = $carwashManager->selectByPK($userId); } } } } return $this->customer; }