From 7e7cbc4cc8024c7a54304d69222e4a7be308ef0a Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Wed, 13 Nov 2024 21:54:25 -0600 Subject: [PATCH] seems to work just fine now, needs translations --- app/Rules/AlphaEncrypted.php | 6 +++--- app/Rules/NumericEncrypted.php | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Rules/AlphaEncrypted.php b/app/Rules/AlphaEncrypted.php index 5e0ffcbd52..048c663717 100644 --- a/app/Rules/AlphaEncrypted.php +++ b/app/Rules/AlphaEncrypted.php @@ -17,12 +17,12 @@ class AlphaEncrypted implements ValidationRule { try { $decrypted = Crypt::decrypt($value); - dump($decrypted); - if (!ctype_alpha($decrypted)) { + if (!ctype_alpha($decrypted) && !is_null($decrypted)) { $fail($attribute.' is not alphabetic.'); } } catch (\Exception $e) { - $fail($e->getMessage()); + report($e); + $fail('something went wrong.'); } } } diff --git a/app/Rules/NumericEncrypted.php b/app/Rules/NumericEncrypted.php index f36c4174ed..bef4aad5ed 100644 --- a/app/Rules/NumericEncrypted.php +++ b/app/Rules/NumericEncrypted.php @@ -16,13 +16,15 @@ class NumericEncrypted implements ValidationRule */ public function validate(string $attribute, mixed $value, Closure $fail): void { + try { - $value = Crypt::decrypt($value); - if (!is_numeric($value)) { + $decrypted = Crypt::decrypt($value); + if (!is_numeric($decrypted) && !is_null($decrypted)) { $fail($attribute.' is not numeric.'); } } catch (\Exception $e) { - $fail($e->getMessage()); + report($e->getMessage()); + $fail('something went wrong'); } } }