PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` spamResponder = $spamResponder; } public function handle(Request $request, Closure $next): Response { if (! config('honeypot.enabled')) { return $next($request); } if (! $request->isMethod('POST')) { return $next($request); } $nameFieldName = config('honeypot.name_field_name'); if (config('honeypot.randomize_name_field_name')) { $nameFieldName = $this->getRandomizedNameFieldName($nameFieldName, $request->all()); } if (! $this->shouldCheckHoneypot($request, $nameFieldName)) { return $next($request); } if (! $request->has($nameFieldName)) { return $this->respondToSpam($request, $next); } $honeypotValue = $request->get($nameFieldName); if (! empty($honeypotValue)) { return $this->respondToSpam($request, $next); } if (config('honeypot.valid_from_timestamp')) { $validFrom = $request->get(config('honeypot.valid_from_field_name')); if (! $validFrom) { return $this->respondToSpam($request, $next); } try { $time = new EncryptedTime($validFrom); } catch (Exception $decryptException) { $time = null; } if (! $time || $time->isFuture()) { return $this->respondToSpam($request, $next); } } return $next($request); } protected function getRandomizedNameFieldName($nameFieldName, $requestFields): ?string { return collect($requestFields) ->filter(fn ($value, $key) => Str::startsWith($key, $nameFieldName)) ->keys() ->first(); } protected function respondToSpam(Request $request, Closure $next): Response { event(new SpamDetectedEvent($request)); return $this->spamResponder->respond($request, $next); } private function shouldCheckHoneypot(Request $request, ?string $nameFieldName): bool { if (config('honeypot.honeypot_fields_required_for_all_forms') == true) { return true; } return $request->has($nameFieldName) || $request->has(config('honeypot.valid_from_field_name')); } }