From d2b24f3a297f8341db639c2174a7723325f4c2f6 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Thu, 26 Feb 2026 09:49:27 +0530 Subject: [PATCH] static otp for dev mode : GWM --- app/Controllers/AgentAuthController.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app/Controllers/AgentAuthController.php b/app/Controllers/AgentAuthController.php index abdc6ba..d34b32c 100644 --- a/app/Controllers/AgentAuthController.php +++ b/app/Controllers/AgentAuthController.php @@ -32,11 +32,21 @@ class AgentAuthController extends ResourceController if (isset($agentData['id'])) { - $otp = random_int(100000, 999999); + if (env('CI_ENVIRONMENT') === 'development') { + $otp = 123456; // Static OTP for development + } else { + $otp = random_int(100000, 999999); + } $update = $this->AgentModel->where('mobile', $mobile)->where('is_active', 1)->set(['email_otp' => $otp])->update(); if ($update) { + + // Skip SMS in development + if (env('CI_ENVIRONMENT') === 'development') { + $result = ['agent_verification' => true, 'message' => "Verified Successfully (DEV MODE - OTP: 123456)" ]; + return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200); + } $SMSResult = sendOtpSms($mobile,$otp); @@ -74,11 +84,21 @@ class AgentAuthController extends ResourceController if (isset($agentData['id'])) { - $otp = random_int(100000, 999999); + if (env('CI_ENVIRONMENT') === 'development') { + $otp = 123456; // Static OTP for development + } else { + $otp = random_int(100000, 999999); + } $update = $this->AgentModel->where('email', $email)->where('is_active', 1)->set(['email_otp' => $otp])->update(); if ($update) { + + // Skip SMS in development + if (env('CI_ENVIRONMENT') === 'development') { + $result = ['agent_verification' => true, 'message' => "Verified Successfully (DEV MODE - OTP: 123456)" ]; + return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200); + } $EmailResult = trigger_email('login_otp',['email'=>$email, 'name'=>$agentData['name'], 'otp'=>$otp, ]);