我正在使用laravel 5.4和auth登录,注册,密码重置功能一切正常,当我尝试重置密码时,它发送电子邮件并更改密码工作正常..更改新密码后,它将我重定向到主页,它得到自动登录,但我想要的是更改后的密码将我重定向到登录页面,以便使用可以检查更改的密码是否正常工作..
所以我的问题如何实现这一点???
我的ResetPasswordController是
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
当我尝试将$ redirect更改为变量作为登录时,它会向我抛出一个页面无效的错误.....我只是处于困惑状态请帮助我
1 回答
您需要在位于
app/Http/Controllers/Auth.
的ResetPasswordController
中进行以下更改将重定向路径更改为登录页面 .
覆盖resetPassword方法以防止用户登录 . 将其添加到控制器 .
在顶部使用
use Illuminate\Support\Str;
.要在重定向上发送自定义响应,您可以覆盖控制器中的
sendResetResponse
并添加任何自定义会话/闪存消息 . 默认情况下,laravel会在成功重置密码时设置自己的响应 .