From 7ff2282607bff67d26bb2aaa93e3b3dce831b9ae Mon Sep 17 00:00:00 2001 From: Mohamed Mahmoud Date: Thu, 24 Aug 2023 15:49:30 +0300 Subject: [PATCH] Handling DecryptException in JavascriptInputValue --- src/InputValues/JavascriptInputValue.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/InputValues/JavascriptInputValue.php b/src/InputValues/JavascriptInputValue.php index a2f13f4..ab9f034 100644 --- a/src/InputValues/JavascriptInputValue.php +++ b/src/InputValues/JavascriptInputValue.php @@ -4,6 +4,7 @@ namespace Lukeraymonddowning\Honey\InputValues; +use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Support\Facades\Crypt; class JavascriptInputValue implements InputValue @@ -15,6 +16,10 @@ public function getValue(): string public function checkValue($value): bool { - return Crypt::decrypt($value) == "Honey"; + try { + return Crypt::decrypt($value) == "Honey"; + } catch (DecryptException) { + return false; + } } -} \ No newline at end of file +}