예제 #1
0
 /**
  * authenticaction for case tracker
  *
  * @param $case numbre case
  * @param $pin code pin access for case tracek
  * @return array
  * @throws \Exception
  */
 public function authentication($case, $pin)
 {
     $cases = new \Cases();
     $response = array();
     $uid = $cases->verifyCaseTracker($case, $pin);
     switch ($uid) {
         //The case doesn't exist
         case -1:
             throw new \Exception(\G::LoadTranslation('ID_CASE_NOT_EXISTS'));
             break;
             //The pin is invalid
         //The pin is invalid
         case -2:
             throw new \Exception(\G::LoadTranslation('ID_PIN_INVALID'));
             break;
     }
     $response['process'] = $uid['PRO_UID'];
     $response['app_uid'] = $uid['APP_UID'];
     return $response;
 }
예제 #2
0
if (!isset($_POST['form'])) {
    G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', "error");
    G::header("location: login.php");
    die;
}
try {
    $frm = $_POST['form'];
    $case = '';
    $pin = '';
    if (isset($frm['CASE'])) {
        $case = strtolower(trim($frm['CASE']));
        $pin = trim($frm['PIN']);
    }
    G::LoadClass('case');
    $cases = new Cases();
    $uid = $cases->verifyCaseTracker($case, $pin);
    switch ($uid) {
        //The case doesn't exist
        case -1:
            G::SendTemporalMessage('ID_CASE_NOT_EXISTS', "error");
            break;
            //The pin is invalid
        //The pin is invalid
        case -2:
            G::SendTemporalMessage('ID_PIN_INVALID', "error");
            break;
    }
    if ($uid < 0) {
        G::header("location: login.php");
        die;
    }