2017-03-06 118 views
0

任何人都知道爲何路由「/ password/email」在生產服務器上返回404 Not Found錯誤,但適用於本地?Laravel 5 - 無法在生產服務器上重置密碼404 - 未找到

當用戶試圖通過電子郵件(https://compariimobiliare.ro/password/reset)重置密碼時,POST URL https://compariimobiliare.ro/password/email會給出404 Not Found錯誤。相同的URL在本地服務器上正常工作,但不在生產中。

路線是存在的,我能看到它,當我運行命令:

php artisan route:list 

POST | password/email | | App\Http\Controllers\Auth\[email protected] | web,guest 

enter image description here

Laravel默認的實現:

public function sendResetLinkEmail(Request $request) 
{ 
     $this->validate($request, ['email' => 'required|email']); 

     // We will send the password reset link to this user. Once we have attempted 
     // to send the link, we will examine the response then see the message we 
     // need to show to the user. Finally, we'll send out a proper response. 
     $response = $this->broker()->sendResetLink(
      $request->only('email') 
     ); 

     if ($response === Password::RESET_LINK_SENT) { 
      return back()->with('status', trans($response)); 
     } 

     // If an error was returned by the password broker, we will get this message 
     // translated so we can notify a user of the problem. We'll redirect back 
     // to where the users came from so they can attempt this process again. 
     return back()->withErrors(
      ['email' => trans($response)] 
     ); 
    } 
+0

你可以在控制器'ForgotPasswordController'中顯示'sendResetLinkEmail'方法的代碼嗎? – KuKeC

回答

1

我可以看到你有POST路線密碼/電子郵件。 你有密碼/電子郵件的GET路線嗎? 您正在獲取404,因爲它試圖訪問GET路線。

+0

這是奇怪的部分,表單使用POST動作,但我得到404未找到GET錯誤...也許一些奇怪的重定向...嘗試使用郵遞員訪問「https://compariimobiliare.ro/password/email」與POST請求,我得到相同的404未找到錯誤。 –

+0

你如何處理Controller中的POST請求?你是否將用戶重定向到成功形式submision?您是否能夠在App \ Http \ Controllers \ Auth \ ForgotPasswordController @ sendResetLinkEmail –

+0

上分享您的代碼沒有定製,我使用默認的laravel實現,請參閱代碼中的問題描述。 –

相關問題