在管理員登錄後,我在Laravel 5應用程序中使用了更改密碼功能。我正在使用laravel提供的默認表單來更改重定向到/ userpasswords的密碼功能/ email,當用戶點擊「發送密碼重置鏈接」。郵件在郵件標識上發送,但我想更改此網址。我的網址變成http://localhost/bqs_test/public/index.php/password/reset/1f488a5daf26b57af2d928bb9c0b14e627b34c3459d819f471d402c42f476bf2,它是通過電子郵件ID 發送的,但我希望它是http://localhost/bqs_test/public/index.php/userpasswords/reset/1f488a5daf26b57af2d928bb9c0b14e627b34c3459d819f471d402c42f476bf2。我怎麼能做到這一點,我是Laravel的新手,所以請別人幫忙。我的代碼:如何在Laravel 5中更改默認的重置密碼鏈接
<?php echo Form::open(array('url' => '/userpasswords/email', 'method' => 'post','class'=>'form-horizontal')); ?>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="form-group">
<label class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input type="email" class="form-control" name="email" value="{{ Auth::user()->email }}" readonly>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Send Password Reset Link
</button>
</div>
</div>
路線定義爲:
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
'userpasswords' => 'Auth\UserPasswordController'
]);
UserPasswordController與PasswordController相同,但它使用不同的特性ResetPasswords,它與ResetsPasswords相同,只是略有更改。我在ResetPasswords中的postEmail方法是這樣的:
public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
$response = $this->passwords->sendResetLink($request->only('email'), function($m)
{
$m->subject($this->getEmailSubject());
});
switch ($response)
{
case PasswordBroker::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
case PasswordBroker::INVALID_USER:
return redirect()->back()->withErrors(['email' => trans($response)]);
}
}
有人請幫助我如何更改網址。
我想多一個變量來用在刀刃什麼。像{{user_role}}。我如何通過變量? –