Laravel验证电子邮件地址显示403错误页面

问题描述 投票:0回答:1

验证电子邮件地址显示错误403 Sorry, you are not authorized to access this page。用户单击电子邮件中的验证电子邮件地址按钮时发生错误。我尝试在Auth \ VerificationController @ verify处断开,但控制器确实转到此方法。我在这做错了什么。

在localhost上工作正常。我在托管服务器中遇到此问题

路线设定

 Auth::routes(['verify' =>  true]); 

邮件服务器设置

 MAIL_DRIVER=smtp
 MAIL_HOST=smtp.gmail.com
 MAIL_PORT=587
 [email protected]
 MAIL_PASSWORD=gmailpassword
 MAIL_ENCRYPTION=tls

我已经完成了stackoverflow问题,不适合或完全解决了这个问题

照亮\基金会\验证\ VerifiesEmails

public function verify(Request $request)
{
    if ($request->route('id') == $request->user()->getKey() &&
        $request->user()->markEmailAsVerified()) {
        event(new Verified($request->user()));
    }

    return redirect($this->redirectPath())->with('verified', true);
}
php laravel http-status-codes
1个回答
0
投票

我有同样的问题,因为我需要在AppServiceProvider中使用URL::forceScheme('https');来使Laravel Telescope在代理后面工作。我还没有找到解决方案使电子邮件验证和望远镜在我的环境中工作,但删除URL::forceScheme('https');修复了403

一些开发人员报告说,将protected $proxies = '*';添加到TrustProxies中间件已经帮助解决了403问题,对我来说不起作用但可能值得尝试。 https://laravel.com/docs/5.7/requests#configuring-trusted-proxies

© www.soinside.com 2019 - 2024. All rights reserved.