| Conditions | 7 |
| Paths | 10 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function handle(Request $request, Closure $next): Response |
||
| 21 | { |
||
| 22 | if (! config('honeypot.enabled')) { |
||
| 23 | return $next($request); |
||
| 24 | } |
||
| 25 | |||
| 26 | $honeypotValue = $request->get(config('honeypot.name_field_name')); |
||
| 27 | |||
| 28 | if (config('honeypot.random_name_field_name')) { |
||
| 29 | if(! $request->has(session()->get('name_field_name'))) { |
||
| 30 | return $this->respondToSpam($request, $next); |
||
| 31 | } |
||
| 32 | |||
| 33 | $honeypotValue = $request->get(session()->get('name_field_name')); |
||
| 34 | } |
||
| 35 | |||
| 36 | if (! empty($honeypotValue)) { |
||
| 37 | return $this->respondToSpam($request, $next); |
||
| 38 | } |
||
| 39 | |||
| 40 | if ($validFrom = $request->get(config('honeypot.valid_from_field_name'))) { |
||
| 41 | if ((new EncryptedTime($validFrom))->isFuture()) { |
||
| 42 | return $this->respondToSpam($request, $next); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | return $next($request); |
||
| 47 | } |
||
| 48 | |||
| 56 |