Browse Source

bug fix

master
filesite 2 months ago
parent
commit
ee0c2b8a8b
  1. 7
      themes/beauty/controller/SiteController.php

7
themes/beauty/controller/SiteController.php

@ -901,7 +901,7 @@ Class SiteController extends Controller { @@ -901,7 +901,7 @@ Class SiteController extends Controller {
$expireSeconds = 600; //缓存 10 分钟
$maxFailNum = 5; //最多失败次数
$ipTryData = Common::getCacheFromFile($ipLockKey, $expireSeconds, $lockCacheDir);
if (!empty($ipTryData) && $ipTryData['fail'] >= $maxFailNum) {
if (!empty($ipTryData) && $ipTryData['fail'] >= $maxFailNum && time() - $ipTryData['at'] < $expireSeconds) {
$authed = false;
$minutes = $expireSeconds/60;
$errorMsg = "密码错误已达 {$maxFailNum} 次,请 {$minutes} 分钟后再试!";
@ -916,7 +916,12 @@ Class SiteController extends Controller { @@ -916,7 +916,12 @@ Class SiteController extends Controller {
'fail' => 1,
);
}else {
if (time() - $ipTryData['at'] < $expireSeconds) {
$ipTryData['fail'] ++;
}else {
$ipTryData['fail'] = 1;
}
$ipTryData['at'] = time();
}
Common::saveCacheToFile($ipLockKey, $ipTryData, $lockCacheDir);

Loading…
Cancel
Save