Add OTP_MODE variable to .env.dist. Modify checking for the confirmCode to set, depending on the value of OTP_MODE. #237

This commit is contained in:
Korina Cordero 2019-07-29 05:33:12 +00:00
parent 85844aae3a
commit a18654b0d1
2 changed files with 12 additions and 2 deletions

View file

@ -39,3 +39,6 @@ REDIS_CLIENT_PASSWORD=foobared
POLICY_PROMO=insertpromopolicyidhere
POLICY_THIRD_PARTY=insertthirdpartypolicyidhere
POLICY_MOBILE=insertmobilepolicyidhere
# OTP
OTP_MODE=settotestorrandom

View file

@ -239,8 +239,16 @@ class APIController extends Controller
// phone number
$phone_number = $req->request->get('phone_number');
// get otp_mode from .env
$dotenv = new Dotenv();
$dotenv->loadEnv(__DIR__.'/../../.env');
$otp_mode = $_ENV['OTP_MODE'];
// check if the phone number is our test number
if ($phone_number == '639991112233')
//if ($phone_number == '639991112233')
// check if otp_mode is test
if ($otp_mode == 'test')
{
$code = '123456';
$this->session->setConfirmCode($code)
@ -255,7 +263,6 @@ class APIController extends Controller
// TODO: validate phone number
// generate code and save
// $code = '123456';
$code = $this->generateConfirmCode();
$this->session->setConfirmCode($code)
->setPhoneNumber($phone_number);