重设密码后限制登录 laravel 5.6
restrict from login after reset password laravel 5.6
我正在使用 laravel-5.6 默认身份验证系统来重置密码、注册和登录 (php artisan make:auth
)。在密码重置中,当我成功重置密码时,它会验证我并将我重定向到下一页。以及在注册时做同样的事情。我如何限制那些在 reset/registration 之后对我进行身份验证?我希望它通过一条闪现消息将我引导回“/”路线。 TIA
密码重置:
在(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.'
}
我没有注册控制器的代码,但你可以使用上面提到的相同方法覆盖该方法。
我正在使用 laravel-5.6 默认身份验证系统来重置密码、注册和登录 (php artisan make:auth
)。在密码重置中,当我成功重置密码时,它会验证我并将我重定向到下一页。以及在注册时做同样的事情。我如何限制那些在 reset/registration 之后对我进行身份验证?我希望它通过一条闪现消息将我引导回“/”路线。 TIA
密码重置:
在(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.'
}
我没有注册控制器的代码,但你可以使用上面提到的相同方法覆盖该方法。