【发布时间】:2017-07-26 09:06:26
【问题描述】:
任何人都知道为什么路由“/password/email”在生产服务器上返回 404 Not Found 错误,但在本地工作?
当用户尝试通过电子邮件 (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\ForgotPasswordController@sendResetLinkEmail | web,guest
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)]
);
}
【问题讨论】:
-
你能在控制器
ForgotPasswordController中显示方法sendResetLinkEmail的代码吗?
标签: laravel routes http-status-code-404 password-recovery