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, ]);