首页 > 解决方案 > 未找到 HTTP 异常 - 在 Laravel 中以及如何使用自己的方法重置密码

问题描述

我正在尝试实现重置密码功能,但我收到错误未找到 http 异常,我想实现我自己的密码重置方法,但我使用 laravel 自己的功能,但我无法解决这个解决方案我还附上了我的屏幕截图:在此处输入图像描述

我的控制器:

class ResetPasswordController extends Controller
{
    use ResetsPasswords;

    /**
    * Create a new password controller instance.
    *
    * @return void
    */
    public function __construct()
    {
        $this->middleware('guest');
    }
    public function getSendResetLinkEmailSuccessResponse()
    {
        return View::make('auth.passwordSent');
    }
    protected $redirectPath = '/';
 }

我的表格:

<form action="/password/reset" method="post">
    <input type="hidden" name="_token" value="{{ csrf_token() }}">
    <div class="form-group">
        <label for="login-form-email">E-mail</label>
        <input type="email" name="email" id="email" class="form-control" tabindex="1" placeholder="Email" value="{{ old('email') }}">
    </div>
    <div class="form-group">
        <label for="login-form-password">New password</label>
        <input type="password" class="form-control" name="password" id="login-form-password" tabindex="2" placeholder="Password" tabindex="4">
    </div><!-- /.form-group -->
    <div class="form-group">
        <label for="login-form-password-retype">Confirm new password</label>
        <input type="password" class="form-control" name="password_confirmation" id="login-form-password-retype" tabindex="3" placeholder="Confirm password">
    </div><!-- /.form-group -->
    <div class="form-group">
        <input type="submit"  class="btn btn-primary pull-right" name="reset-confirm" id="reset-confirm" tabindex="4" value="Reset Password">
    </div>
</form>

当我收到电子邮件时,我的电子邮件页面查看页面:

<html>
    <head>
        <title>Welcome Email</title>
    </head>
    <body>
        <h2>Hello {{$user['first_name']}}</h2>
        <br/>
        You are receiving this email because we received a password reset request for your account.
        <br/>
        <a href="{{url('/password/reset', $user->reset_token)}}">Reset 
        Password</a>
        <br />
        <p>If you did not request a password reset, no further action is required.<br />Regards,<br /><strong>Triple R Lense</strong></p>
    </body>
</html>

和我的路线:

 Route::get('/password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
 Route::post('/password/reset', 'Auth\ResetPasswordController@reset');

您的帮助将不胜感激?

标签: phplaravelpasswordstoken

解决方案


推荐阅读