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