2016-06-09 70 views
2

我正試圖在laravel 5.2中完成密碼重置。一切正常,直到最後一部分。Laravel密碼重置路由未找到

當我進入我的電子郵件和新密碼,收到了錯誤的RouteCollection.php線

MethodNotAllowedHttpException 219:

這裏是我的路線

Route::get('/password/reset/email', 'Auth\[email protected]'); 
Route::post('/password/reset/email', 'Auth\[email protected]'); 

Route::get('/password/email', 'Auth\[email protected]'); 

Route::get('/password/reset/{token}', 'Auth\[email protected]'); 
Route::post('/password/reset', 'Auth\[email protected]'); 

這就是我的控制器的樣子。

<?php 

namespace App\Http\Controllers\Auth; 

use View; 
use App\Http\Controllers\Controller; 
use Illuminate\Foundation\Auth\ResetsPasswords; 

class PasswordController extends Controller 
{ 
    /* 
    |-------------------------------------------------------------------------- 
    | Password Reset Controller 
    |-------------------------------------------------------------------------- 
    | 
    | This controller is responsible for handling password reset requests 
    | and uses a simple trait to include this behavior. You're free to 
    | explore this trait and override any methods you wish to tweak. 
    | 
    */ 

    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="" 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> 

不知道爲什麼我得到這個錯誤,我無法找到一個解決的辦法。希望你們能幫助我

+0

哪條線是219? – jszobody

+0

正在發送的URL是什麼? – aynber

+0

您的表單可能通過GET提交而不是POST? – jszobody

回答

2

這是你的復位路線:

Route::post('/password/reset', 'Auth\[email protected]'); 
表單中的

然而,你是不是張貼到這條路線:

<form action="" method="post"> 

改變你的行動:到/密碼形式的

<form action="/password/reset" method="post"> 
+0

謝謝,我不敢相信我沒有看到這個我自己。這asnewer是解決方案 – Nicolas

+0

沒有概率,很高興幫助! – jszobody

1

設置動作/復位