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

时间:2019-02-26 09:20:45

标签: php laravel http-status-codes

验证电子邮件地址显示错误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
 MAIL_USERNAME=yourgmailid@gmail.com
 MAIL_PASSWORD=gmailpassword
 MAIL_ENCRYPTION=tls

我已经解决了stackoverflow问题,这些问题不适合或无法完全解决

Illuminate \ Foundation \ Auth \ VerifyEmails

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);
}

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,因为我需要AppServiceProvider中的[Const3]才能使Laravel Telescope在代理后面工作。我还没有找到一种使电子邮件验证和Telescope都能在我的环境中工作的解决方案,但是删除Const1 = "1000" Const2 = "2000" Const3 = "3000" CONST_LIST = [Const1, Const2] CONST_LIST_NEW = CONST_LIST + [Const3] print CONST_LIST_NEW 修复了URL::forceScheme('https');

一些开发人员报告说,将URL::forceScheme('https');添加到TrustProxies  中间件解决了403问题,对我不起作用,但也许值得尝试。 https://laravel.com/docs/5.7/requests#configuring-trusted-proxies

相关问题