Login api changes : GWM
This commit is contained in:
parent
03fa3b1603
commit
165044f7f2
@ -65,6 +65,9 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function verifyEmployeeWithMobileNumber()
|
||||
{
|
||||
try {
|
||||
@ -77,9 +80,10 @@ class RestAuthenticationController extends AdminController
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
|
||||
if ($employeeData) {
|
||||
|
||||
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
||||
$result = ['user_verification' => true ,'message' => "Verified Successfully" ];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
} else {
|
||||
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||
@ -151,6 +155,19 @@ class RestAuthenticationController extends AdminController
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
}
|
||||
|
||||
private function callThirdPartyAPI($postData)
|
||||
{
|
||||
$client = \Config\Services::curlrequest();
|
||||
$thirdPartyUrl = "https://venbait.in/nhance/dev/employeeRest/getVerifiedUserData";
|
||||
|
||||
$response = $client->post($thirdPartyUrl, [
|
||||
'json' => $postData, // Sending JSON body
|
||||
'http_errors' => false // Prevent errors from stopping execution
|
||||
]);
|
||||
|
||||
return json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
|
||||
public function getVerifiedUserData()
|
||||
@ -191,12 +208,13 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
|
||||
$result = JWTToken::encode($employeeData);
|
||||
|
||||
// Call the third-party API function
|
||||
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON());
|
||||
if(isset($this->request->getJSON()->otp)){
|
||||
$this->employeeModel->where('email_corporate', $email_id)->where('otp', $otp)->where('relationship', 'self')->set(['otp'=>null])->update();
|
||||
}
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result , 'post_enrollment'=> $apiResponse],200);
|
||||
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user