Skip to content

Commit 94157af

Browse files
committed
fix(security): 调整验证码触发频率并配置极验密钥
- 将验证码触发频率从每10次访问调整为每5次访问 - 配置极验验证码的密钥参数 - 更新IP访问计数逻辑的注释说明
1 parent f55dff1 commit 94157af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/b3log/symphony/processor/middleware/AnonymousViewCheckMidware.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public void handle(final RequestContext context) {
197197
ipFirstVisitTimeCache.put(ip, firstVisitTime);
198198
}
199199

200-
// 计数逻辑(包含两种策略:2 小时内首次访问一次验证码,其后每 10 次一次)
200+
// 计数逻辑(包含两种策略:2 小时内首次访问一次验证码,其后每 5 次一次)
201201
Integer count = ipVisitCountCache.getIfPresent(ip);
202202
if (count == null) count = 0;
203203
count++;
@@ -217,8 +217,8 @@ public void handle(final RequestContext context) {
217217
}
218218
}
219219

220-
// 之后每访问 10 次需要一次验证码
221-
if (!needCaptcha && count % 10 == 0) {
220+
// 之后每访问 5 次需要一次验证码
221+
if (!needCaptcha && count % 5 == 0) {
222222
needCaptcha = true;
223223
}
224224

0 commit comments

Comments
 (0)