diff --git a/app/Http/Middleware/HumanVerification.php b/app/Http/Middleware/HumanVerification.php index a39debc384ccfb8a86bbc3f7a3c99311431f4054..1e5f4f73d6f9b6bbb484a89a9811e363d7197f65 100644 --- a/app/Http/Middleware/HumanVerification.php +++ b/app/Http/Middleware/HumanVerification.php @@ -7,6 +7,7 @@ use Captcha; use Closure; use Cookie; use Illuminate\Http\Response; +use Log; use URL; class HumanVerification @@ -66,7 +67,6 @@ class HumanVerification } else { $user = $users[$uid]; } - # Lock out everyone in a Bot network # Find out how many requests this IP has made $sum = 0; @@ -130,8 +130,10 @@ class HumanVerification } } + } catch (\Exception $e) { + Log::error($e->getMessage()); } finally { - if ($update) { + if ($update && $user != null) { if ($user["whitelist"]) { $user["expiration"] = now()->addWeeks(2); } else { @@ -148,7 +150,6 @@ class HumanVerification public function setUser($prefix, $user) { - // Lock must be acquired within 2 seconds $userList = Cache::get($prefix . "." . $user["id"], []); $userList[$user["uid"]] = $user; Cache::put($prefix . "." . $user["id"], $userList, 2 * 7 * 24 * 60 * 60);