CHANGE : active policy check in login api
This commit is contained in:
parent
913a8b6574
commit
e589580b48
@ -83,24 +83,26 @@ class RestAuthenticationController extends AdminController
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
|
||||
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)
|
||||
->where('relationship', 'self')
|
||||
->where('emp_status !=', 'truncated')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
$employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id')
|
||||
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.relationship', 'self')
|
||||
->where('employees.emp_status !=', 'truncated')
|
||||
->where('employees.mobile', $mobile_number)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['draft', 'enrolled'])
|
||||
->first();
|
||||
|
||||
|
||||
|
||||
|
||||
if ($employeeData) {
|
||||
|
||||
if (isset($employeeData['employee_id']))
|
||||
{
|
||||
$result = ['user_verification' => true ,'message' => "Verified Successfully" ];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
} else {
|
||||
// Call the third-party API function
|
||||
return $this->callThirdPartyAPI($this->request->getJSON(),'verifyEmployeeNumber');
|
||||
|
||||
// $result = ['user_verification' => false , 'message' => "User not found"];
|
||||
// return $this->respond(['status' => 'failed','code' => 404,'data' => $result, 'post_enrollment'=> json_decode($apiResponse, true)],200);
|
||||
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
@ -113,11 +115,18 @@ class RestAuthenticationController extends AdminController
|
||||
$email = $this->request->getJSON()->email;
|
||||
|
||||
|
||||
$employeeData = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
|
||||
->where('emp_status !=', 'truncated')->where('is_active', 1)
|
||||
$employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id')
|
||||
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.relationship', 'self')
|
||||
->where('employees.emp_status !=', 'truncated')
|
||||
->where('employees.email_corporate', $email)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['draft', 'enrolled'])
|
||||
->first();
|
||||
|
||||
if ($employeeData) {
|
||||
if (isset($employeeData['employee_id']))
|
||||
{
|
||||
|
||||
$otp = random_int(100000, 999999);
|
||||
|
||||
@ -161,10 +170,6 @@ class RestAuthenticationController extends AdminController
|
||||
} else {
|
||||
// Call the third-party API function
|
||||
return $this->callThirdPartyAPI($this->request->getJSON(),'verifyEmployeeEmailId');
|
||||
|
||||
// $result = ['user_verification' => false , 'message' => "User not found"];
|
||||
// return $this->respond(['status' => 'failed','code' => 404,'data' => $result, 'post_enrollment'=> json_decode($apiResponse, true)],200);
|
||||
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user