| | |
| | | public function handleLogin(WP_REST_Request $request): WP_REST_Response |
| | | { |
| | | $data = $request->get_params(); |
| | | error_log('Data: '.print_r($data, true)); |
| | | // Verify Turnstile |
| | | if (!$this->verifyTurnstile($data['cf-turnstile-response'] ?? '')) { |
| | | return $this->error('Security verification failed', 'turnstile_failed', 403); |
| | |
| | | } |
| | | |
| | | // Lockout expired - clear attempts |
| | | $this->cache->delete($cache_key); |
| | | $this->cache->forget($cache_key); |
| | | return true; |
| | | } |
| | | |
| | |
| | | protected function clearFailedAttempts(string $username): void |
| | | { |
| | | $cache_key = 'login_attempts_' . md5($username); |
| | | $this->cache->delete($cache_key); |
| | | $this->cache->forget($cache_key); |
| | | } |
| | | |
| | | |