重置密码后,我需要重定向到登录页面。 你们能帮我吗。它会自动重定向到“ /”网址。
答案 0 :(得分:0)
如果您使用laravel auth,则可以在此处找到ResetPasswordController:
App\Http\Controllers\Auth\ResetPasswordController
只需更改:
protected $redirectTo
要路由。
如果要在重置密码后忽略登录,则应在ResetPasswords特性中编辑ResetPassword函数,该特性在ResetPasswordController中使用,如下所示:
protected function resetPassword($user, $password)
{
$user->password = Hash::make($password);
$user->setRememberToken(Str::random(60));
$user->save();
event(new PasswordReset($user));
//you should comment below and redirect any route you want like:
// return redirect('http://example.com');
$this->guard()->login($user);
}
答案 1 :(得分:0)
在 Laravel 5.8 中,您可以这样做- 在您的 ResetPasswordController 中应该如下所示
errorTreatment(error.networkResponse.statusCode);
答案 2 :(得分:0)
我得到的唯一解决方案是,更改位于vendor / laravel / framework / src / illuminate / Foundation / Auth文件夹中的ResetPasswords.php文件中的功能。
protected function resetPassword($user, $password)
{
$user->password = Hash::make($password);
$user->setRememberToken(Str::random(60));
$user->save();
event(new PasswordReset($user));
return redirect()->route('login');
}