简体   繁体   English

Safari 和 Laravel - 邮件验证

[英]Safari and Laravel - Mail Verification

Background Story背景故事

I've been developing a Laravel application for about a month now.我已经开发 Laravel 应用程序大约一个月了。 During the development I've only used google chrome for testing the application.在开发过程中,我只使用 google chrome 来测试应用程序。 The project makes use of Laravels mustverify to verify the users email.该项目使用 Laravel mustverify 来验证用户 email。 This works flawless in google chrome, however, when I switched to my MacBook, using safari, things got ugly.这在谷歌浏览器中完美无缺,但是,当我使用 safari 切换到我的 MacBook 时,事情变得丑陋了。

The Problem问题

When I get the mail from the application to my mail-client, I usually just click the link "Verify Email Address" shown below.当我从应用程序收到邮件到我的邮件客户端时,我通常只需单击下面显示的链接“验证 Email 地址”。 However, this just does not work in Safari.但是,这在 Safari 中不起作用。 Normally I get sent to the user-panel as a verified user (in google chrome), but in Safari, I get redirected to the login-page (not verified or "logged in"), as of if the session does not exist in the safari browser.通常,我作为经过验证的用户(在谷歌浏览器中)被发送到用户面板,但在 Safari 中,我被重定向到登录页面(未验证或“登录”),就像 session 不存在一样safari 浏览器。

验证电子邮件的图片

So what have I tried?那么我尝试了什么?

  • Try another browser on my Mac: Downloaded google chrome, works just fine.在我的 Mac 上尝试其他浏览器:下载的 google chrome,运行良好。
  • Spent a few hours on reading the documentation of the Auth process of Laravel.花了几个小时阅读 Laravel 的 Auth 过程的文档。

I also read this post that says that Safari requires a "www."我还阅读了这篇文章,上面说 Safari 需要“www”。 in front of the url to make it understand.前面的url让大家明白。 But how would I achieve this in a localhost?但是我将如何在本地主机中实现这一点?

So now I'm reaching out to you for tips, thoughts or ideas.所以现在我正在与您联系以获取提示、想法或想法。 I will list some information below that might be relevant:我将在下面列出一些可能相关的信息:

  • PHP version: 7.3.24 PHP 版本:7.3.24
  • Laravel Version: 8.20.1 Laravel 版本:8.20.1
  • Software Stack: LEMP & LAMP (running both on different machines to test)软件堆栈:LEMP & LAMP(在不同机器上运行以进行测试)
  • Safari Version: 14.0.2 Safari 版本:14.0.2

The error was that Safari did not trust the links that mailtrap provided me with.错误是 Safari 不信任 mailtrap 提供给我的链接。 When switching to a normal mail client, everything works fine.切换到普通邮件客户端时,一切正常。

Edit your session.same_site config to use none or null编辑您的session.same_site配置以使用nonenull

don't forget to use lax or strict in production不要忘记在生产中使用laxstrict

probably a Safari Bug... but this is how I fixed it...可能是 Safari 错误...但这就是我修复它的方式...

I've provided an answer here also...我在这里也提供了答案...

https://laracasts.com/discuss/channels/laravel/laravel-8-email-verification-not-working-with-different-browsers https://laracasts.com/discuss/channels/laravel/laravel-8-email-verification-not-working-with-different-browsers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM