2017-03-06 80 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实现,请参阅代码中的问题描述。 –

相关问题