如何在Laravel 5中更改默认重置密码链接 [英] How to Change Default Reset Password Link in Laravel 5

查看:85
本文介绍了如何在Laravel 5中更改默认重置密码链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

管理员登录后,我在Laravel 5应用程序中使用了更改密码功能.我正在使用laravel提供的默认格式来更改密码功能,该表格会重定向到/userpasswords/email,当用户单击发送密码重置链接".邮件已通过邮件ID发送,但我想更改此URL.我的网址变为 http://localhost/bqs_test/public/index.php/password通过电子邮件ID发送的reset/1f488a5daf26b57af2d928bb9c0b14e627b34c3459d819f471d402c42f476bf2 但我希望它成为 http://localhost/bqs_test/public/index. php/userpasswords/reset/1f488a5daf26b57af2d928bb9c0b14e627b34c3459d819f471d402c42f476bf2 .我该怎么做,我是Laravel的新手,所以请他人帮助.我的代码是:

I am using a change password functionality in my Laravel 5 Application after the Admin has logged in. I am using the default form provided by laravel for change password functionality which redirects to /userpasswords/email, When the user click on the "Send Password Reset Link". A mail is sent on the mail id but I want to change this url. My url becomes http://localhost/bqs_test/public/index.php/password/reset/1f488a5daf26b57af2d928bb9c0b14e627b34c3459d819f471d402c42f476bf2 which is sent on the email id but I want it to be as http://localhost/bqs_test/public/index.php/userpasswords/reset/1f488a5daf26b57af2d928bb9c0b14e627b34c3459d819f471d402c42f476bf2. How can I do this, I am new to Laravel, so please someone help. My code is as:

<?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方法类似于:

The UserPasswordController is same as PasswordController but it uses a different trait ResetPasswords which is same as ResetsPasswords with slight change. My postEmail method in ResetPasswords is like:

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

请帮助我更改网址的人.

Someone please help how can I change the Url.

推荐答案

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

you can edit or create this view to change what you want to send

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

这篇关于如何在Laravel 5中更改默认重置密码链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆