我想为密码重置做一些自定义路线,这是我到目前为止所做的:
首先,我创建了自己的路线
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);
Route::get('/olvide-mi-contrasena', [
'as' => 'clubOlvide',
'uses' => 'Auth\PasswordController@getEmail'
]);
Route::post('/olvide-mi-contrasena', [
'as' => 'clubPostOlvide',
'uses' => 'Auth\PasswordController@postEmail'
]);
Route::get('/restablecer-contrasena/{token}', [
'as' => 'clubRestablecer',
'uses' => 'Auth\PasswordController@getReset'
]);
Route::post('/restablecer-contrasena/{token}', [
'as' => 'clubPostRestablecer',
'uses' => 'Auth\PasswordController@postReset'
]);
其次,我在 PasswordController 覆盖了 ResetsPasswords 特征
private $redirectTo = '/ingresar';
public function getEmail()
{
return view('Club.auth.password');
}
public function getReset($token = null)
{
if (is_null($token))
{
throw new NotFoundHttpException;
}
return view('Club.auth.reset')->with('token', $token);
}
三、改变view处的action
<form class="form-horizontal" role="form" method="POST" action="{{ route('clubPostRestablecer',['token' => $token]) }}">
四、我编辑了邮件配置
return [
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => ['address' => 'soporte@domain.tld', 'name' => 'Support'],
'encryption' => 'tls',
'username' => 'googlemail@gmail.com',
'password' => 'googlePassword',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
];
我测试了它......它发送重置链接,并且链接有效,它重置密码,但它使用默认路由,我希望它发送自定义路由,这就是我的意思:
收到的电子邮件(我将在链接中用单词令牌替换真实令牌,以使帖子更具可读性):
点击这里重置您的密码:
我想要它是什么:
点击这里重置您的密码:
如果我复制发送到的令牌并将其password/reset/token
粘贴它restablecer-contrasena/token
可以工作,所以我想知道如何更改发送到电子邮件的链接?