GWM
This commit is contained in:
parent
68c4c38b02
commit
9b7a67bda7
@ -93,6 +93,7 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$otp = $this->request->getJSON()->otp;
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Received mobile_number = " . $mobile_number);
|
||||
|
||||
|
||||
@ -116,7 +117,7 @@ class RestAuthenticationController extends AdminController
|
||||
log_message('error', ' ');
|
||||
log_message('error', '************************ PRE END ********************************');
|
||||
|
||||
$otp = random_int(100000, 999999);
|
||||
|
||||
$sql = "
|
||||
UPDATE employees
|
||||
INNER JOIN employee_polices ON employee_polices.employee_id = employees.id
|
||||
@ -146,8 +147,15 @@ class RestAuthenticationController extends AdminController
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: OTP update query Failed. SQL = " . $db->getLastQuery());
|
||||
|
||||
$result = ['user_verification' => false, 'message' => "Try again. , try again"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: No matching employee found");
|
||||
log_message('error', ' ');
|
||||
@ -296,6 +304,7 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
|
||||
$email = $this->request->getJSON()->email;
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$otp = $this->request->getJSON()->otp;
|
||||
$client_id = $this->request->getJSON()->client_id ?? null;
|
||||
$employee_id = $this->request->getJSON()->employee_id ?? null;
|
||||
@ -305,14 +314,13 @@ class RestAuthenticationController extends AdminController
|
||||
->where('relationship', 'Self')
|
||||
->where('is_active', 1);
|
||||
|
||||
// $builder = $this->employeeModel
|
||||
// ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
|
||||
// ->where('employees.email_corporate', $email)
|
||||
// ->where('employees.relationship', 'Self')
|
||||
// ->where('employees.is_active', 1)
|
||||
// ->whereIn('employees.emp_status', ['active', 'expired'])
|
||||
// ->where('EP.is_active', 1)
|
||||
// ->whereIn('EP.status', ['active', 'expired']);
|
||||
if (!empty($email)) {
|
||||
$builder->where('email_corporate', $email);
|
||||
}
|
||||
|
||||
if (!empty($mobile_number)) {
|
||||
$builder->where('mobile', $mobile_number);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($client_id)) {
|
||||
@ -445,17 +453,11 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
try {
|
||||
|
||||
$otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null;
|
||||
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
|
||||
|
||||
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
|
||||
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
|
||||
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
|
||||
$client_id = $this->request->getJSON()->client_id ?? null;
|
||||
|
||||
if (isset($this->request->getJSON()->login_by_hr))
|
||||
{
|
||||
$employeeData = $this->employeeModel->where('id', $this->request->getJSON()->employee_id)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
|
||||
}else{
|
||||
if (isset($mobile_number))
|
||||
{
|
||||
// $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
|
||||
@ -467,7 +469,8 @@ class RestAuthenticationController extends AdminController
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active', 'expired'])
|
||||
->where('employees.is_active', 1)
|
||||
->whereIn('employees.emp_status', ['active', 'expired']);
|
||||
->whereIn('employees.emp_status', ['active', 'expired'])
|
||||
->where('otp', $otp);
|
||||
|
||||
if (!empty($client_id)) {
|
||||
$builder->where('employees.client_id', $client_id);
|
||||
@ -494,14 +497,15 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
$employeeData = $builder->orderBy('employees.id', 'desc')->first();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$lastQuery = $this->employeeModel->db->getLastQuery();
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Last Executed Query: " . $lastQuery);
|
||||
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: employeeData: " . json_encode($employeeData ?? []));
|
||||
|
||||
|
||||
if ($employeeData && $otp_verification == true || $employeeData && isset($this->request->getJSON()->login_by_hr) || $employeeData && isset($this->request->getJSON()->otp) ) {
|
||||
if ($employeeData && isset($this->request->getJSON()->otp) )
|
||||
{
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
$data = [
|
||||
@ -1424,6 +1428,10 @@ class RestAuthenticationController extends AdminController
|
||||
->where('employees.mobile', $mobile_number)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['active', 'expired']);
|
||||
|
||||
if (!empty($otp)) {
|
||||
$builder->where('employees.otp', $otp);
|
||||
}
|
||||
|
||||
if (!empty($old_mpin)) {
|
||||
$builder->where('employees.mpin', $old_mpin);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user