Browse Source

add config for sms code cache time

master
filesite 7 months ago
parent
commit
64dc1a7340
  1. 1
      conf/app.php
  2. 3
      themes/tajian/controller/FrontapiController.php

1
conf/app.php

@ -125,6 +125,7 @@ $configs = array(
//源码下载:https://git.filesite.io/filesite/service-3rd //源码下载:https://git.filesite.io/filesite/service-3rd
'service_3rd_api_domain' => 'https://service.filesite.io', 'service_3rd_api_domain' => 'https://service.filesite.io',
'service_3rd_api_key' => '你的密钥', 'service_3rd_api_key' => '你的密钥',
'sms_code_cache_time' => 600, //短信验证码缓存时长,单位:秒
); );

3
themes/tajian/controller/FrontapiController.php

@ -453,7 +453,8 @@ eof;
$rndCode_created = !empty($_SESSION['randSmsCode_created']) ? $_SESSION['randSmsCode_created'] : 0; $rndCode_created = !empty($_SESSION['randSmsCode_created']) ? $_SESSION['randSmsCode_created'] : 0;
$current_time = time(); $current_time = time();
if (!empty($rndCode_created) && $current_time - $rndCode_created > 600) { $max_cache_time = !empty(FSC::$app['config']['sms_code_cache_time']) ? FSC::$app['config']['sms_code_cache_time'] : 600;
if (!empty($rndCode_created) && $current_time - $rndCode_created > $max_cache_time) {
$rndCode = 0; $rndCode = 0;
} }

Loading…
Cancel
Save