fix(captcha): close human-verification loop end-to-end

Rewrite captcha core around aksrt_captcha_config only, require captcha
on login/comment/SMS/phone auth and related gates, wire frontend token
collection, and remove dead dual-source security settings plus slider enqueue.
This commit is contained in:
2026-07-13 19:52:30 +08:00
parent a0808bbe54
commit 02f77b756c
21 changed files with 1163 additions and 1515 deletions
@@ -182,63 +182,47 @@ class AKSRT_Settings_Capabilities {
}
/**
* 获取"网站安全"设置
* 获取"网站安全"设置(人机验证见 aksrt_get_captcha_status_summary)。
*/
public static function get_security_settings(): array {
$s = AKSRT_Settings::get_all();
$verification_type = sanitize_key((string) ($s['user_verification_type'] ?? 'slider'));
$allowed_types = ['image', 'slider', 'tcaptcha', 'geetest', 'null'];
if (!in_array($verification_type, $allowed_types, true)) {
$verification_type = 'slider';
}
$captcha = function_exists('aksrt_get_captcha_status_summary')
? aksrt_get_captcha_status_summary()
: ['enabled' => false, 'provider' => '', 'configured' => false, 'scenes' => []];
return [
'verification_type' => $verification_type,
'verification_comment_s' => !empty($s['verification_comment_s']),
'verification_newposts_s' => !empty($s['verification_newposts_s']),
'verification_bbspost_s' => !empty($s['verification_bbspost_s']),
'verification_links_s' => !empty($s['verification_links_s'] ?? true),
'verification_signin_exclude' => sanitize_text_field((string) ($s['verification_signin_exclude'] ?? '')),
'geetest_enabled' => !empty($s['geetest_enabled']),
'geetest_id' => sanitize_text_field((string) ($s['geetest_id'] ?? '')),
'geetest_key' => sanitize_text_field((string) ($s['geetest_key'] ?? '')),
'tcaptcha_enabled' => !empty($s['tcaptcha_enabled']),
'tcaptcha_appid' => sanitize_text_field((string) ($s['tcaptcha_appid'] ?? '')),
'tcaptcha_secret_key' => sanitize_text_field((string) ($s['tcaptcha_secret_key'] ?? '')),
'brush_limit_post' => [
'captcha' => $captcha,
'brush_limit_post' => [
'enabled' => !empty($s['brush_limit_post_enabled']),
'minutes_10' => (int) ($s['brush_limit_post_minutes_10'] ?? 20),
'day_1' => (int) ($s['brush_limit_post_day_1'] ?? 50),
],
'brush_limit_comment' => [
'brush_limit_comment' => [
'enabled' => !empty($s['brush_limit_comment_enabled']),
'minutes_10' => (int) ($s['brush_limit_comment_minutes_10'] ?? 20),
'day_1' => (int) ($s['brush_limit_comment_day_1'] ?? 100),
],
'brush_limit_upload' => [
'brush_limit_upload' => [
'enabled' => !empty($s['brush_limit_upload_enabled']),
'minutes_10' => (int) ($s['brush_limit_upload_minutes_10'] ?? 50),
'day_1' => (int) ($s['brush_limit_upload_day_1'] ?? 200),
],
'brush_limit_register' => [
'brush_limit_register' => [
'enabled' => !empty($s['brush_limit_register_enabled']),
'minutes_10' => (int) ($s['brush_limit_register_minutes_10'] ?? 20),
'day_1' => (int) ($s['brush_limit_register_day_1'] ?? 100),
],
'brush_limit_order' => [
'brush_limit_order' => [
'enabled' => !empty($s['brush_limit_order_enabled']),
'minutes_10' => (int) ($s['brush_limit_order_minutes_10'] ?? 30),
'day_1' => (int) ($s['brush_limit_order_day_1'] ?? 100),
],
'error_frequency_limit' => !empty($s['error_frequency_limit'] ?? true),
'user_disable_admin' => !empty($s['user_disable_admin'] ?? true),
'disabled_pingback' => !empty($s['disabled_pingback'] ?? true),
'disabled_xmlrpc' => !empty($s['disabled_xmlrpc'] ?? true),
'close_attachment_page' => !empty($s['close_attachment_page'] ?? true),
'error_frequency_limit' => !empty($s['error_frequency_limit'] ?? true),
];
}
/**
* 获取"系统工具"设置
*/