From 1c8e2c04223f33bdf2ee7b1961056062ea306191 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Sat, 17 Aug 2024 11:18:30 +0700 Subject: [PATCH] 10 minutes for request resend OTP, 20 minutes for expired --- system/controllers/accounts.php | 4 ++-- system/controllers/register.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/system/controllers/accounts.php b/system/controllers/accounts.php index 1c40cef8..06ec95ae 100644 --- a/system/controllers/accounts.php +++ b/system/controllers/accounts.php @@ -153,8 +153,8 @@ switch ($action) { $phoneFile = $otpPath . sha1($username . $db_pass) . "_phone.txt"; // expired 10 minutes - if (file_exists($otpFile) && time() - filemtime($otpFile) < 1200) { - r2(U . 'accounts/phone-update', 'e', Lang::T('Please wait ' . (1200 - (time() - filemtime($otpFile))) . ' seconds before sending another SMS')); + if (file_exists($otpFile) && time() - filemtime($otpFile) < 600) { + r2(U . 'accounts/phone-update', 'e', Lang::T('Please wait ' . (600 - (time() - filemtime($otpFile))) . ' seconds before sending another SMS')); } else { $otp = rand(100000, 999999); file_put_contents($otpFile, $otp); diff --git a/system/controllers/register.php b/system/controllers/register.php index 25e41480..9a432edf 100644 --- a/system/controllers/register.php +++ b/system/controllers/register.php @@ -124,9 +124,9 @@ switch ($do) { } $otpPath .= sha1($username . $db_pass) . ".txt"; //expired 10 minutes - if (file_exists($otpPath) && time() - filemtime($otpPath) < 1200) { + if (file_exists($otpPath) && time() - filemtime($otpPath) < 600) { $ui->assign('username', $username); - $ui->assign('notify', 'Please wait ' . (1200 - (time() - filemtime($otpPath))) . ' seconds before sending another SMS'); + $ui->assign('notify', 'Please wait ' . (600 - (time() - filemtime($otpPath))) . ' seconds before sending another SMS'); $ui->assign('notify_t', 'd'); $ui->display('register-otp.tpl'); } else {