登录注册体系的源码级硬切换

This commit is contained in:
2026-08-23 20:30:01 +08:00
parent 73fcd4ed72
commit af52f9e94d
72 changed files with 1666 additions and 6576 deletions
-43
View File
@@ -17,20 +17,6 @@ class ToolsController extends ControllerBase {
}
public function register_routes(): void {
// Health: email verification status
register_rest_route(self::API_NAMESPACE, '/health/email-verification', [
'methods' => 'GET',
'callback' => [$this, 'rest_health_email_verification'],
'permission_callback' => [$this, 'check_permission'],
]);
// Health: REST block toggle
register_rest_route(self::API_NAMESPACE, '/health/rest-block', [
'methods' => 'POST',
'callback' => [$this, 'rest_set_rest_block'],
'permission_callback' => [$this, 'check_permission'],
]);
// Email rollback: list users with recent email changes
register_rest_route(self::API_NAMESPACE, '/email-rollback/users', [
'methods' => 'GET',
@@ -213,35 +199,6 @@ class ToolsController extends ControllerBase {
]);
}
public function rest_health_email_verification(): \WP_REST_Response {
$feature_enabled = class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::registration_requires_email_verification();
$pending_users = 0;
if (class_exists('\AKSRT\Auth\EmailVerification')) {
global $wpdb;
$pending_users = (int) $wpdb->get_var(
"SELECT COUNT(*) FROM {$wpdb->usermeta} WHERE meta_key = 'aksrt_email_verified' AND CAST(meta_value AS UNSIGNED) = 0"
);
}
return $this->success(['data' => [
'feature_enabled' => $feature_enabled,
'pending_users' => $pending_users,
'rest_blocking_active' => !empty(get_option('aksrt_rest_block_email_verification', false)),
]]);
}
public function rest_set_rest_block(\WP_REST_Request $request): \WP_REST_Response {
$params = $this->get_json_params($request);
$enabled = !empty($params['enabled']);
update_option('aksrt_rest_block_email_verification', $enabled);
return $this->success([
'message' => $enabled ? __('已启用 REST 邮箱验证阻断', 'aksrt') : __('已关闭 REST 邮箱验证阻断', 'aksrt'),
'data' => ['enabled' => $enabled],
]);
}
public function rest_email_rollback_list(\WP_REST_Request $request): \WP_REST_Response {
if (!class_exists('\AKSRT\Auth\EmailRollback')) {
return $this->success(['data' => ['items' => [], 'total' => 0, 'page' => 1, 'per_page' => 20]]);