FIX_VRIFY_MPIN : RV

This commit is contained in:
VENKATESHWARAN 2025-04-01 09:39:28 +05:30
parent eb0e0bc7d9
commit 15f080e1df

View File

@ -413,47 +413,44 @@ class RestAuthenticationController extends AdminController
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
$mpin = $this->request->getJSON()->mpin;
if (isset($mobile_number))
{
if (isset($mobile_number)) {
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
}else{
} else {
$employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('relationship', 'self')->first();
}
if ($employeeData && $mpin == $employeeData["mpin"]) {
$auth = HttpRequestHelper::getRequestInfo();
if ($auth) {
$data = [
'user_id' => $employeeData['id'],
'user_type' => 'employee',
'ip' => $auth['ip'],
'platform' => $auth['platform'],
'broswer' => $auth['browser'],
'user_id' => $employeeData['id'],
'user_type' => 'employee',
'ip' => $auth['ip'],
'platform' => $auth['platform'],
'broswer' => $auth['browser'],
];
$authdata= $this->authHistoryModel->insert($data);
$authdata = $this->authHistoryModel->insert($data);
}
$result = JWTToken::encode($employeeData);
// Call the third-party API function
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'verifyMpin');
return $this->respond(['status' => 'success','code' => 200,'data' => $result , 'post_enrollment'=> json_decode($apiResponse, true)],200);
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(), 'verifyMpin');
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'post_enrollment' => json_decode($apiResponse, true)], 200);
} else {
// Call the third-party API function
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'/employeeRest/verifyMpin');
return $this->respond(['status' => 'success','code' => 200 , 'post_enrollment'=> json_decode($apiResponse, true)],200);
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(), '/employeeRest/verifyMpin');
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => "Invalid OTP", 'post_enrollment' => json_decode($apiResponse, true)], 200);
//$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'/getVerifiedUserData');
// return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP", 'post_enrollment'=> json_decode($apiResponse, true)],200);
}
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
return $this->respond(['status' => 'failed', 'code' => 200, 'post_enrollment' => json_decode($apiResponse, true)], 200);
}
}