首页 文章

如何更改Laravel 5中的默认重置密码链接

提问于
浏览
1

我在管理员登录后在Laravel 5应用程序中使用更改密码功能 . 我使用laravel提供的默认表单来更改密码功能,重定向到/ userpasswords / email,当用户单击"Send Password Reset Link"时 . 邮件会在邮件ID上发送,但我想更改此邮件 . 我的网址变为http://localhost/bqs_test/public/index.php/password/reset/1f488a5daf26b57af2d928bb9c0b14e627b34c3459d819f471d402c42f476bf2,这是通过电子邮件ID发送的,但我希望它是http://localhost/bqs_test/public/index.php/userpasswords/reset/1f488a5daf26b57af2d928bb9c0b14e627b34c3459d819f471d402c42f476bf2 . 我怎么能这样做,我是Laravel的新手,所以请有人帮忙 . 我的代码如下:

<?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)]);
    }
}

有人请帮助我如何更改网址 .

1 回答

  • 4

    您可以编辑或创建此视图以更改要发送的内容

    <!-- resources/views/emails/password.blade.php -->
    Click here to reset your password: {{ url('userpasswords/reset/'.$token) }}
    

相关问题