diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 339f353d..abdffbdf 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -210,10 +210,20 @@ class RestAuthenticationController extends AdminController $client_id = $this->request->getJSON()->client_id ?? null; $employee_id = $this->request->getJSON()->employee_id ?? null; + // $builder = $this->employeeModel + // ->where('email_corporate', $email) + // ->where('relationship', 'Self') + // ->where('is_active', 1); + $builder = $this->employeeModel - ->where('email_corporate', $email) - ->where('relationship', 'Self') - ->where('is_active', 1); + ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner') + ->where('employees.email_corporate', $email) + ->where('employees.relationship', 'Self') + ->where('employees.is_active', 1) + ->whereIn('employees.emp_status', ['active', 'expired']) + ->where('EP.is_active', 1) + ->whereIn('EP.status', ['active', 'expired']); + if (!empty($client_id)) { $builder->where('client_id', $client_id); @@ -225,7 +235,6 @@ class RestAuthenticationController extends AdminController $builder->set(['otp' => $otp])->update(); - return true; } @@ -585,7 +594,7 @@ class RestAuthenticationController extends AdminController if(isset($HRAccessData['allowed_modules'])){ $hrData['0']['allowed_modules'] = json_decode($HRAccessData['allowed_modules'],true)['post']; }else{ $hrData['0']['allowed_modules'] = []; } - + $hrData['0']['token_type'] = 'post'; $result = JWTToken::encode($hrData['0']);