diff --git a/app/Config/Routes.php b/app/Config/Routes.php index eca94e6..6c58447 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -435,6 +435,7 @@ $routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationControll //HR login api's $routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber"); +$routes->post("/employeeRest/verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail"); $routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData"); $routes->group("/api", ["filter" => "authJWT"], function ($routes) { diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 354fe72..aa5ad0d 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -291,6 +291,30 @@ class RestAuthenticationController extends AdminController return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); } } + + public function verifyHrWithEmail() + { + try { + $email = $this->request->getJSON()->email; + + $HrData = $this->hrModel->where('email', $email) + ->where('contact_type', 'client') + ->where('is_active', 1) + ->first(); + + if ($HrData) { + + $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(),'verifyHrWithEmail'); + + } + } catch (\Throwable $th) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); + } + } public function getVerifiedHrData() @@ -329,7 +353,7 @@ class RestAuthenticationController extends AdminController } else { - + // Call the third-party API function $apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedHrData'); return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP" , 'post_enrollment'=> json_decode($apiResponse, true)],200);