diff --git a/app/Controllers/StaffAuthController.php b/app/Controllers/StaffAuthController.php index 72ccd75..bc7678a 100644 --- a/app/Controllers/StaffAuthController.php +++ b/app/Controllers/StaffAuthController.php @@ -35,11 +35,21 @@ class StaffAuthController extends ResourceController if (isset($StaffData['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->StaffModel->where('mobile', $mobile)->where('is_active', 1)->set(['email_otp' => $otp])->update(); if ($update) { + + // Skip SMS in development + if (env('CI_ENVIRONMENT') === 'development') { + $result = ['Staff_verification' => true, 'message' => "Verified Successfully (DEV MODE - OTP: 123456)" ]; + return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200); + } $SMSResult = sendOtpSms($mobile,$otp); @@ -77,11 +87,21 @@ class StaffAuthController extends ResourceController if (isset($StaffData['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->StaffModel->where('email', $email)->where('is_active', 1)->set(['email_otp' => $otp])->update(); if ($update) { + + // Skip SMS in development + if (env('CI_ENVIRONMENT') === 'development') { + $result = ['Staff_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'=>$StaffData['name'], 'otp'=>$otp, ]);