重置密码后限制登录laravel 5.6

时间:2018-08-05 11:46:29

标签: laravel-5.6

我正在使用laravel-5.6默认身份验证系统来重置密码,注册和登录(php artisan make:auth)。在密码重置中,当我成功重置密码时,它将对我进行身份验证并将我重定向到下一页。以及在注册中做同样的事情。重置/注册后,如何限制那些人对我进行身份验证?我希望它通过一条简短的消息将我引导回“ /”路线。 TIA

1 个答案:

答案 0 :(得分:1)

密码重置:

在(lluminate / Foundation / Auth / ResetsPasswords.php)中,有一个名为“ reset”的函数,该函数负责在重置密码后登录。 在ResetPasswordConroller中,可以通过如下创建新函数来覆盖此函数。

public function reset(Request $request)
{
    $this->validate($request, $this->rules(), $this->validationErrorMessages());

    // Here we will attempt to reset the user's password. If it is successful we
    // will update the password on an actual user model and persist it to the
    // database. Otherwise we will parse the error and return the response.
    $response = $this->broker()->reset(
        $this->credentials($request), function ($user, $password) {
            $this->resetPassword($user, $password);
        }
    );


    return 'whatever you wanna return.'
}

我没有注册控制器的代码,但是您可以使用上述相同的方法来覆盖该方法。

相关问题