Skip to content

A free open source IT asset/license management system

translations and attribute names

spencerrlongg95cd7793343a
diff --git a/app/Rules/AlphaEncrypted.php b/app/Rules/AlphaEncrypted.php
index 048c663717..102e03dd6b 100644
--- a/app/Rules/AlphaEncrypted.php
+++ b/app/Rules/AlphaEncrypted.php
@@ -16,9 +16,10 @@ class AlphaEncrypted implements ValidationRule
public function validate(string $attribute, mixed $value, Closure $fail): void
{
try {
+ $attributeName = trim(preg_replace('/_+|snipeit|\d+/', ' ', $attribute));
$decrypted = Crypt::decrypt($value);
if (!ctype_alpha($decrypted) && !is_null($decrypted)) {
- $fail($attribute.' is not alphabetic.');
+ $fail(trans('validation.custom.alpha_encrypted', ['attribute' => $attributeName]));
}
} catch (\Exception $e) {
report($e);
diff --git a/app/Rules/NumericEncrypted.php b/app/Rules/NumericEncrypted.php
index bef4aad5ed..c4bf865f3b 100644
--- a/app/Rules/NumericEncrypted.php
+++ b/app/Rules/NumericEncrypted.php
@@ -18,9 +18,10 @@ class NumericEncrypted implements ValidationRule
{
try {
+ $attributeName = trim(preg_replace('/_+|snipeit|\d+/', ' ', $attribute));
$decrypted = Crypt::decrypt($value);
if (!is_numeric($decrypted) && !is_null($decrypted)) {
- $fail($attribute.' is not numeric.');
+ $fail(trans('validation.custom.numeric_encrypted', ['attribute' => $attributeName]));
}
} catch (\Exception $e) {
report($e->getMessage());
diff --git a/resources/lang/en-US/validation.php b/resources/lang/en-US/validation.php
index 7d7840eb42..d054c8b439 100644
--- a/resources/lang/en-US/validation.php
+++ b/resources/lang/en-US/validation.php
@@ -187,6 +187,8 @@ return [
'custom' => [
'alpha_space' => 'The :attribute field contains a character that is not allowed.',
+ 'alpha_encrypted' => 'The :attribute field should be alphabetic characters.',
+ 'numeric_encrypted' => 'The :attribute field should be numeric characters.',
'email_array' => 'One or more email addresses is invalid.',
'hashed_pass' => 'Your current password is incorrect',
'dumbpwd' => 'That password is too common.',