How can I customize the error messages (such as \"These credentials do not match our records.\"
) that are displayed upon unsuccessful login/registration without
You don't want to override the getFailedLoginMessage() method in AuthController. The proper solution is to change the message in the designed location. If you look in the Resources > lang > en folder, you will see an auth.php file. In it, there is a "failed" attribute with a message you can customize. Change it there. The orignial getFailedLoginMessage() method in the Laravel auth files in vendor looks to that location for a custom message first, before settling on the default.
You can override getFailedLoginMessage
on the AuthController
which comes from the AuthenticatesUsers
trait
protected function getFailedLoginMessage()
{
return 'what you want here.';
}
Or not override it and set a lang value for auth.failed
. The getFailedLoginMessage
method will check for Lang::has('auth.failed')
and use that if its available.
For the actual validation error messages you can override the postLogin
and pass your own array of messages to validate
, or if you wanted to change them globally you can adjust them in the appropriate lang file in resources/lang/{lang}/validation.php
.