I want to change the default login validation error message like:
Username & Password doesn't match
instead of
these credentials do not match our records
How to do this ?
This error message means that your user name and/or password that you entered to log in are not correct. Please try logging in again.
In the user login controller in the login module, there are the following codes: $loggedIn = $this->auth->login( [ 'email' => $request->email, 'password' => $request->password, ], (bool) $request->get('remember_me', false) );
Laravel includes built-in authentication and session services which are typically accessed via the Auth and Session facades. These features provide cookie-based authentication for requests that are initiated from web browsers. They provide methods that allow you to verify a user's credentials and authenticate the user.
You can change this message to another one in this file:
resources/lang/en/auth.php
This is the line:
'failed' => 'These credentials do not match our records.',
In app/Http/controllers/Auth/LoginController
add below code:
protected function sendFailedLoginResponse(Request $request)
{
throw ValidationException::withMessages([
'username or password is incorrect!!!'
]);
}
In the sendFailedLoginResponse
function you can redirect user to custom page or show error alert.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With