示例#1
0
 /**
  * Validates user credentials
  *
  * @return TRUE - if validation passed, and FALSE - otherwise
  */
 public function validate()
 {
     if (ObserverManager::getInstance()->validate($this->getId(), $this->getUniqueId())) {
         return true;
     }
     throw new InvalidUserException("wrong user");
 }
 public function service()
 {
     unset($_SESSION['can_revert']);
     $userId = NGS()->getSessionManager()->getUserId();
     $observerDto = ObserverManager::getInstance()->selectByPK($userId);
     $areaId = $observerDto->getAreaId();
     $observerId = NGS()->getSessionManager()->getUserId();
     $ret = RealVoterNumberTmpManager::getInstance()->revertObserverLastInput($areaId, $observerId);
     if (!$ret) {
         $_SESSION['error_message'] = "You can not revert!";
     }
     $this->redirect('');
 }
示例#3
0
 public function service()
 {
     $observerDto = ObserverManager::getInstance()->getByHash(NGS()->args()->getHash());
     if (!$observerDto) {
         $ret = new stdClass();
         $ret->status = 'error';
         $ret->message = 'Wrong hash!';
         echo json_encode($ret);
         exit;
     }
     $ret = new stdClass();
     $ret->status = 'ok';
     echo json_encode($ret);
     exit;
 }
示例#4
0
 public function service()
 {
     $observerDto = ObserverManager::getInstance()->getByUsernamePassword(NGS()->args()->getUsername(), NGS()->args()->getPassword());
     if (!$observerDto) {
         $_SESSION['error_message'] = "Wrong login/password";
         $this->redirect('login');
     }
     $hash = $observerDto->getHash();
     if (!empty($hash)) {
         $_SESSION['error_message'] = "Account currenctly is in used!";
         $this->redirect('login');
     }
     NGS()->getSessionManager()->login(UserGroups::$OBSERVER, $observerDto->getId());
     $this->redirect('');
 }
示例#5
0
 public function service()
 {
     $observerDto = ObserverManager::getInstance()->getByUsernamePassword(NGS()->args()->getUsername(), NGS()->args()->getPassword());
     if (!$observerDto) {
         $ret = new stdClass();
         $ret->status = 'error';
         $ret->message = 'Wrong login/password!';
         echo json_encode($ret);
         exit;
     }
     $ret = new stdClass();
     $ret->status = 'ok';
     $ret->hash = $observerDto->getHash();
     echo json_encode($ret);
     exit;
 }
示例#6
0
 public function service()
 {
     if (!isset(NGS()->args()->number) || empty(NGS()->args()->number) || NGS()->args()->number <= 0) {
         $_SESSION['error_message'] = "Please input positive number";
         $this->redirect('');
     }
     $number = intval(NGS()->args()->getNumber());
     $userId = NGS()->getSessionManager()->getUserId();
     $observerDto = ObserverManager::getInstance()->selectByPK($userId);
     $areaId = $observerDto->getAreaId();
     $rowId = RealVoterNumberTmpManager::getInstance()->addRow($number, $userId, $areaId);
     $dto = RealVoterNumberTmpManager::getInstance()->selectByPK($rowId);
     $voterId = $dto->getVoterId();
     $_SESSION['can_revert'] = 1;
     if ($voterId > 0) {
         $voter = VoterManager::getInstance()->selectByPK($voterId);
         $_SESSION['success_message'] = $number . ' ' . $voter->getFirstName() . ' ' . $voter->getLastName() . ' Successfully added';
     } else {
         $_SESSION['error_message'] = "Number does not exist in list!";
         $this->redirect('');
     }
     $this->redirect('');
 }
示例#7
0
 public function service()
 {
     ObserverManager::getInstance()->updateField(NGS()->getSessionManager()->getUserID(), 'hash', '');
     NGS()->getSessionManager()->logout();
     $this->redirect('login');
 }
示例#8
0
 public function load()
 {
     $selectAll = ObserverManager::getInstance()->selectAll();
     $this->addParam('rows', $selectAll);
 }
示例#9
0
 public function service()
 {
     $rowId = NGS()->args()->getRowId();
     ObserverManager::getInstance()->updateField($rowId, 'hash', '');
 }