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'); } } }