繁体   English   中英

如何修改 Laravel 中的登录错误消息?

[英]How can I modify login error message in Laravel?

我正在使用 Laravel 6,我的项目运行良好,但是当我输入错误的登录详细信息时,出现错误。

这些凭据与我们的记录不符。

如果用户名或密码有错误,我如何modify this error message并提供我的custom message 我试图在LoginController和 Laravel vendor folder找到此消息,但找不到。 谁能告诉我此错误消息所在的文件的确切位置?

您可以在/resources/lang/en/auth.php更改它。

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines are used during authentication for various
    | messages that we need to display to the user. You are free to modify
    | these language lines according to your application's requirements.
    |
    */

    'failed' => 'These credentials do not match our records.',
    'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',

];

你可以在这个位置找到

resources/lang/en/auth.php

如果你想要一些自定义的和更具体的检查 AuthenticatesUsers.php 并覆盖 LoginController.php 中的函数sendFailedLoginResponse

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM