Login api changes : GWM
This commit is contained in:
parent
03fa3b1603
commit
165044f7f2
@ -65,6 +65,9 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function verifyEmployeeWithMobileNumber()
|
public function verifyEmployeeWithMobileNumber()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -77,6 +80,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
if ($employeeData) {
|
if ($employeeData) {
|
||||||
|
|
||||||
$result = ['user_verification' => true ,'message' => "Verified Successfully" ];
|
$result = ['user_verification' => true ,'message' => "Verified Successfully" ];
|
||||||
@ -152,6 +156,19 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
public function getVerifiedUserData()
|
||||||
{
|
{
|
||||||
@ -191,12 +208,13 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
$result = JWTToken::encode($employeeData);
|
$result = JWTToken::encode($employeeData);
|
||||||
|
// Call the third-party API function
|
||||||
|
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON());
|
||||||
if(isset($this->request->getJSON()->otp)){
|
if(isset($this->request->getJSON()->otp)){
|
||||||
$this->employeeModel->where('email_corporate', $email_id)->where('otp', $otp)->where('relationship', 'self')->set(['otp'=>null])->update();
|
$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 {
|
} else {
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user