【问题标题】:Laravel Verify Email Address showing 403 error pageLaravel 验证电子邮件地址显示 403 错误页面
【发布时间】:2019-07-19 19:04:01
【问题描述】:

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

在本地主机上它工作正常。我在托管服务器中遇到了这个问题

路线设置

 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\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】:

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

一些开发人员报告称,将 protected $proxies = '*'; 添加到 TrustProxies 中间件有助于解决 403 问题,对我不起作用,但也许值得一试。 https://laravel.com/docs/5.7/requests#configuring-trusted-proxies

【讨论】:

    猜你喜欢
    • 2020-03-02
    • 2020-01-03
    • 1970-01-01
    • 2014-06-12
    • 1970-01-01
    • 2019-03-25
    • 2018-05-26
    • 2018-03-13
    • 2011-09-02
    相关资源
    最近更新 更多