mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-03 09:57:45 -08:00
translations and attribute names
This commit is contained in:
parent
8c6869fd34
commit
95cd779334
|
@ -16,9 +16,10 @@ class AlphaEncrypted implements ValidationRule
|
||||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$attributeName = trim(preg_replace('/_+|snipeit|\d+/', ' ', $attribute));
|
||||||
$decrypted = Crypt::decrypt($value);
|
$decrypted = Crypt::decrypt($value);
|
||||||
if (!ctype_alpha($decrypted) && !is_null($decrypted)) {
|
if (!ctype_alpha($decrypted) && !is_null($decrypted)) {
|
||||||
$fail($attribute.' is not alphabetic.');
|
$fail(trans('validation.custom.alpha_encrypted', ['attribute' => $attributeName]));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
report($e);
|
report($e);
|
||||||
|
|
|
@ -18,9 +18,10 @@ class NumericEncrypted implements ValidationRule
|
||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$attributeName = trim(preg_replace('/_+|snipeit|\d+/', ' ', $attribute));
|
||||||
$decrypted = Crypt::decrypt($value);
|
$decrypted = Crypt::decrypt($value);
|
||||||
if (!is_numeric($decrypted) && !is_null($decrypted)) {
|
if (!is_numeric($decrypted) && !is_null($decrypted)) {
|
||||||
$fail($attribute.' is not numeric.');
|
$fail(trans('validation.custom.numeric_encrypted', ['attribute' => $attributeName]));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
report($e->getMessage());
|
report($e->getMessage());
|
||||||
|
|
|
@ -187,6 +187,8 @@ return [
|
||||||
|
|
||||||
'custom' => [
|
'custom' => [
|
||||||
'alpha_space' => 'The :attribute field contains a character that is not allowed.',
|
'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.',
|
'email_array' => 'One or more email addresses is invalid.',
|
||||||
'hashed_pass' => 'Your current password is incorrect',
|
'hashed_pass' => 'Your current password is incorrect',
|
||||||
'dumbpwd' => 'That password is too common.',
|
'dumbpwd' => 'That password is too common.',
|
||||||
|
|
Loading…
Reference in a new issue