| @@ -45,8 +45,9 @@ | ||
| 45 | 45 | ], |
| 46 | 46 | 'execute_callback' => 'wdesignkit_mcp_login', |
| 47 | 47 | 'permission_callback' => 'wdesignkit_mcp_permission_callback', |
| 48 | 48 | 'meta' => [ |
| 49 | + 'public' => true, | |
| 49 | 50 | 'show_in_rest' => true, |
| 50 | 51 | 'mcp' => ['public' => true], |
| 51 | 52 | 'annotations' => [ |
| 52 | 53 | 'instructions' => implode("\n", [ |
| @@ -90,8 +91,9 @@ | ||
| 90 | 91 | ], |
| 91 | 92 | 'execute_callback' => 'wdesignkit_mcp_login_api_key', |
| 92 | 93 | 'permission_callback' => 'wdesignkit_mcp_permission_callback', |
| 93 | 94 | 'meta' => [ |
| 95 | + 'public' => true, | |
| 94 | 96 | 'show_in_rest' => true, |
| 95 | 97 | 'mcp' => ['public' => true], |
| 96 | 98 | 'annotations' => [ |
| 97 | 99 | 'instructions' => implode("\n", [ |
| @@ -136,8 +138,9 @@ | ||
| 136 | 138 | ], |
| 137 | 139 | 'execute_callback' => 'wdesignkit_mcp_social_login', |
| 138 | 140 | 'permission_callback' => 'wdesignkit_mcp_permission_callback', |
| 139 | 141 | 'meta' => [ |
| 142 | + 'public' => true, | |
| 140 | 143 | 'show_in_rest' => true, |
| 141 | 144 | 'mcp' => ['public' => true], |
| 142 | 145 | 'annotations' => [ |
| 143 | 146 | 'instructions' => implode("\n", [ |
| @@ -190,8 +193,9 @@ | ||
| 190 | 193 | ], |
| 191 | 194 | 'execute_callback' => 'wdesignkit_mcp_signup', |
| 192 | 195 | 'permission_callback' => 'wdesignkit_mcp_permission_callback', |
| 193 | 196 | 'meta' => [ |
| 197 | + 'public' => true, | |
| 194 | 198 | 'show_in_rest' => true, |
| 195 | 199 | 'mcp' => ['public' => true], |
| 196 | 200 | 'annotations' => [ |
| 197 | 201 | 'instructions' => implode("\n", [ |
| @@ -233,8 +237,9 @@ | ||
| 233 | 237 | ], |
| 234 | 238 | 'execute_callback' => 'wdesignkit_mcp_forgot_password', |
| 235 | 239 | 'permission_callback' => 'wdesignkit_mcp_permission_callback', |
| 236 | 240 | 'meta' => [ |
| 241 | + 'public' => true, | |
| 237 | 242 | 'show_in_rest' => true, |
| 238 | 243 | 'mcp' => ['public' => true], |
| 239 | 244 | 'annotations' => [ |
| 240 | 245 | 'instructions' => implode("\n", [ |
| @@ -268,8 +273,9 @@ | ||
| 268 | 273 | ], |
| 269 | 274 | 'execute_callback' => 'wdesignkit_mcp_logout', |
| 270 | 275 | 'permission_callback' => 'wdesignkit_mcp_permission_callback', |
| 271 | 276 | 'meta' => [ |
| 277 | + 'public' => true, | |
| 272 | 278 | 'show_in_rest' => true, |
| 273 | 279 | 'mcp' => ['public' => true], |
| 274 | 280 | 'annotations' => [ |
| 275 | 281 | 'instructions' => implode("\n", [ |
| @@ -317,8 +323,9 @@ | ||
| 317 | 323 | ], |
| 318 | 324 | 'execute_callback' => 'wdesignkit_mcp_get_social_login_url', |
| 319 | 325 | 'permission_callback' => 'wdesignkit_mcp_permission_callback', |
| 320 | 326 | 'meta' => [ |
| 327 | + 'public' => true, | |
| 321 | 328 | 'show_in_rest' => true, |
| 322 | 329 | 'mcp' => ['public' => true], |
| 323 | 330 | 'annotations' => [ |
| 324 | 331 | 'instructions' => implode("\n", [ |
| @@ -349,9 +356,9 @@ | ||
| 349 | 356 | if ($email === '' || $password === '') { |
| 350 | 357 | return ['success' => false, 'message' => 'email and password are required.']; |
| 351 | 358 | } |
| 352 | 359 | |
| 353 | - $user_key = strstr($email, '@', true); | |
| 360 | + $user_key = wdesignkit_cloud_session_key($email); | |
| 354 | 361 | |
| 355 | 362 | // Clear any existing session for this user |
| 356 | 363 | delete_transient('wdkit_auth_' . $user_key); |
| 357 | 364 | |
| @@ -428,9 +435,9 @@ | ||
| 428 | 435 | |
| 429 | 436 | // Response data: user->user_email |
| 430 | 437 | $user_data = $response['user'] ?? []; |
| 431 | 438 | $user_email = strtolower(sanitize_email((string) ($user_data['user_email'] ?? ''))); |
| 432 | - $user_key = $user_email !== '' ? strstr($user_email, '@', true) : ''; | |
| 439 | + $user_key = $user_email !== '' ? wdesignkit_cloud_session_key($user_email) : ''; | |
| 433 | 440 | |
| 434 | 441 | if ($user_key !== '') { |
| 435 | 442 | // $user_data already extracted above: $response['user'] ?? [] |
| 436 | 443 | $cloud_user_id_api = (string) ($user_data['id'] ?? $user_data['user_id'] ?? $response['user_id'] ?? $response['id'] ?? ''); |
| @@ -478,9 +485,9 @@ | ||
| 478 | 485 | // Response contains user->user_email and token at top level |
| 479 | 486 | $user_data = $response['user'] ?? []; |
| 480 | 487 | $user_email = strtolower(sanitize_email((string) ($user_data['user_email'] ?? ''))); |
| 481 | 488 | $token = sanitize_text_field((string) ($response['token'] ?? '')); |
| 482 | - $user_key = $user_email !== '' ? strstr($user_email, '@', true) : ''; | |
| 489 | + $user_key = $user_email !== '' ? wdesignkit_cloud_session_key($user_email) : ''; | |
| 483 | 490 | |
| 484 | 491 | if ($user_key !== '' && $token !== '') { |
| 485 | 492 | $cloud_user_id_social = (string) ($user_data['id'] ?? $user_data['user_id'] ?? $response['user_id'] ?? $response['id'] ?? ''); |
| 486 | 493 | set_transient('wdkit_auth_' . $user_key, [ |
| @@ -519,9 +526,9 @@ | ||
| 519 | 526 | return ['success' => false, 'message' => 'Invalid email address.', 'email' => null]; |
| 520 | 527 | } |
| 521 | 528 | |
| 522 | 529 | $email = strtolower(sanitize_email($raw_email)); |
| 523 | - $user_key = strstr($email, '@', true); | |
| 530 | + $user_key = wdesignkit_cloud_session_key($email); | |
| 524 | 531 | |
| 525 | 532 | // Clear any existing session before signup |
| 526 | 533 | delete_transient('wdkit_auth_' . $user_key); |
| 527 | 534 | |
| @@ -647,9 +654,9 @@ | ||
| 647 | 654 | $email = $auth['email'] ?? ''; |
| 648 | 655 | |
| 649 | 656 | // Delete local session transient |
| 650 | 657 | if ($email !== '') { |
| 651 | - $user_key = strstr($email, '@', true); | |
| 658 | + $user_key = wdesignkit_cloud_session_key($email); | |
| 652 | 659 | delete_transient('wdkit_auth_' . $user_key); |
| 653 | 660 | } |
| 654 | 661 | |
| 655 | 662 | // Drop the active-session pointer so no later call resolves the dead session |