Adds custom validation messages and improves error feedback

Introduces custom validation messages for login and password fields to enhance clarity for users. Updates error feedback text to provide more specific guidance when authentication fails. Fixes formatting issue in the password error message in the view for consistency.
This commit is contained in:
Sholahuddin Al Ayubi
2025-08-12 13:36:28 +07:00
parent 0b377847cf
commit 75701b53a9
2 changed files with 13 additions and 5 deletions

View File

@@ -27,6 +27,14 @@
];
}
public function messages()
{
return [
'login.required' => 'User tidak boleh kosong',
'password.required' => 'Password tidak boleh kosong',
];
}
/**
* Attempt to authenticate the request's credentials.
*
@@ -50,7 +58,7 @@
if (!Auth::attempt($authData, $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'login' => trans('auth.failed'),
'login' => 'Email/NIK atau password tidak sesuai.'
]);
}
@@ -121,7 +129,7 @@
// Authentication failed
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'login' => trans('auth.failed'),
'login' => 'Email/NIK atau password tidak sesuai.',
]);
}