FIX_OTP_ISSUE : RV

This commit is contained in:
VENKATESHWARAN 2025-05-14 12:40:35 +05:30
parent cce1bad6a2
commit f9f134fc4c

View File

@ -138,9 +138,24 @@ class RestAuthenticationController extends AdminController
$otp = random_int(100000, 999999);
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
->where('is_active', 1)->set(array('otp' => $otp ))
->update();
// $update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
// ->where('is_active', 1)->set(array('otp' => $otp ))
// ->update();
$sql = "
UPDATE employees
INNER JOIN employee_polices ON employee_polices.employee_id = employees.id
SET employees.otp = ?
WHERE employees.email_corporate = ?
AND employees.relationship = 'self'
AND employees.is_active = 1
AND employee_polices.is_active = 1
AND employee_polices.status IN ('draft', 'enrolled')
";
$db = db_connect();
$update = $db->query($sql, [$otp, $email]);
if($update)
{
@ -198,7 +213,18 @@ class RestAuthenticationController extends AdminController
}else{
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();
$employeeData = $this->employeeModel
->select('employees.*')
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
->where('employees.is_active', 1)
->where('employees.relationship', 'self')
->where('employees.emp_status !=', 'truncated')
->where('employees.mobile', $mobile_number)
->where('EP.is_active', 1)
->whereIn('EP.status', ['draft', 'enrolled'])
->first();
} else {
$employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('otp', $otp)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
}