【发布时间】:2021-01-12 09:03:31
【问题描述】:
在 Laravel fortify 的自定义身份验证过程中,我无法重定向到带有错误消息的登录页面,而我们可以在 Auth 中执行此操作。 这是自定义文档链接:https://jetstream.laravel.com/1.x/features/authentication.html#customizing-the-authentication-process
if ($user && Hash::check($request->password, $user->password) && $user->status == 'active') {
return $user;
} elseif ($user->status == 'inactive') {
//redirect with some error message to login blade
} elseif ($user->status == 'blocked') {
//redirect with some error message to login blade
}
请帮我解决这个问题。
【问题讨论】:
-
该方法仅用于返回用户,所以你不能在那里做任何重定向......你可以返回
null或false,但你不会有任何自定义留言 -
但是在向用户返回消息的情况下,我如何在 fortify 中做到这一点?
标签: laravel authentication redirect fortify laravel-8