FEAT_DEFAULT_OTP_BIFITS_AND_HR_LOGIN

This commit is contained in:
VENKATESHWARAN 2026-02-26 12:26:21 +05:30
parent 4f4bbfb7b4
commit 7f7754f6aa
2 changed files with 65 additions and 11 deletions

View File

@ -185,3 +185,12 @@ CORS_DEBUG=true
APP_SIGNATURE = APP_SIGNATURE =
TOKENTIMEOUT = TOKENTIMEOUT =
JWT_SECRET = JWT_SECRET =
#--------------------------------------------------------------------
# OTP Configuration
#--------------------------------------------------------------------
DEFAULT_OTP = ''
IS_SEND_EMAIL_OTP =
IS_SEND_SMS_OTP =

View File

@ -158,8 +158,15 @@ class RestAuthenticationController extends AdminController
} }
$otp = random_int(100000, 999999); $otp = random_int(100000, 999999);
if($mobile_number == '9442741776') $default_otp = env('DEFAULT_OTP');
{ $is_send_sms_otp = env('IS_SEND_SMS_OTP');
if(!empty($default_otp)){
$otp = $default_otp;
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Sending default otp");
}
if($mobile_number == '9442741776') {
$otp = '123456'; $otp = '123456';
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: setting 123456 for IOS APP TESTING = " . json_encode($employeeData)); $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: setting 123456 for IOS APP TESTING = " . json_encode($employeeData));
} }
@ -211,13 +218,13 @@ class RestAuthenticationController extends AdminController
} }
//skip sms for live test no //skip sms for live test no
if($mobile_number == '9442741776') if($mobile_number == '9442741776' || $is_send_sms_otp == false) {
{
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: skip SMS sent for IOS APP TESTING = " . ($mobile_number)); $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: skip SMS sent for IOS APP TESTING = " . ($mobile_number));
$result = ['user_verification' => true ,'message' => "Verified Successfully" ]; $result = ['user_verification' => true ,'message' => "Verified Successfully" ];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); return $this->respond(['status' => 'success','code' => 200,'data' => $result, 'is_sms_send' => false],200);
} }
//send sms //send sms
$SMSResult = sendOtpSms($mobile_number, $otp); $SMSResult = sendOtpSms($mobile_number, $otp);
if ($SMSResult['status'] == 'success') if ($SMSResult['status'] == 'success')
@ -276,6 +283,14 @@ class RestAuthenticationController extends AdminController
$otp = random_int(100000, 999999); $otp = random_int(100000, 999999);
$default_otp = env('DEFAULT_OTP');
$is_send_email_otp = env('IS_SEND_EMAIL_OTP');
if(!empty($default_otp)){
$otp = $default_otp;
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Sending default otp");
}
//only retail policy //only retail policy
if(empty($empdata)){ if(empty($empdata)){
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: No employee data found both PRE & POST"); $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: No employee data found both PRE & POST");
@ -387,6 +402,11 @@ class RestAuthenticationController extends AdminController
'mail_type' => 'otp_mail', 'mail_type' => 'otp_mail',
]; ];
if($is_send_email_otp == false){
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'is_email_send' => false], 200);
}
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Sending OTP email to " . $employeeData['email_corporate']); $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Sending OTP email to " . $employeeData['email_corporate']);
$res = $this->sendEmailOtp($employeeData['email_corporate'], $otp, $common); $res = $this->sendEmailOtp($employeeData['email_corporate'], $otp, $common);
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Mail response = " . $res); $this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Mail response = " . $res);
@ -596,6 +616,13 @@ class RestAuthenticationController extends AdminController
$otp = random_int(100000, 999999); $otp = random_int(100000, 999999);
$default_otp = env('DEFAULT_OTP');
$is_send_sms_otp = env('IS_SEND_SMS_OTP');
if(!empty($default_otp)){
$otp = $default_otp;
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Sending default otp");
}
if ($HrData) if ($HrData)
{ {
@ -617,6 +644,11 @@ class RestAuthenticationController extends AdminController
$data->otp = $otp; $data->otp = $otp;
$this->callThirdPartyAPI($data, 'updateHROTP'); $this->callThirdPartyAPI($data, 'updateHROTP');
if($is_send_sms_otp == false){
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'is_sms_send' => false], 200);
}
//send sms //send sms
$SMSResult = sendOtpSms($mobile_number, $otp); $SMSResult = sendOtpSms($mobile_number, $otp);
if ($SMSResult['status'] == 'success') if ($SMSResult['status'] == 'success')
@ -661,7 +693,14 @@ class RestAuthenticationController extends AdminController
->first(); ->first();
$otp = random_int(100000, 999999); $otp = random_int(100000, 999999);
$data->otp = $otp;
$default_otp = env('DEFAULT_OTP');
$is_send_email_otp = env('IS_SEND_EMAIL_OTP');
if(!empty($default_otp)){
$otp = $default_otp;
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Sending default otp");
}
if ($HrData) { if ($HrData) {
@ -686,9 +725,15 @@ class RestAuthenticationController extends AdminController
if($update) if($update)
{ {
$data->otp = $otp; $data->otp = $otp;
$this->callThirdPartyAPI($data, 'updateHROTP'); $this->callThirdPartyAPI($data, 'updateHROTP');
if($is_send_email_otp == false){
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'is_email_send' => false], 200);
}
$common = [ $common = [
'login_type' => 'HR login', 'login_type' => 'HR login',
'login_email' => $email, 'login_email' => $email,