Laravel 5.2 - Auth: display custom error messages

前端 未结 2 1712
生来不讨喜
生来不讨喜 2021-01-04 23:26

How can I customize the error messages (such as \"These credentials do not match our records.\") that are displayed upon unsuccessful login/registration without

2条回答
  •  长情又很酷
    2021-01-04 23:28

    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.

提交回复
热议问题