Django 新手问题:激活视图被调用两次... 99% 的时间 - 无效令牌错误
您好,感谢您查看我的问题。 当用户单击电子邮件中的激活链接时,他们会收到令牌无效错误页面。用户已激活并可以使用该网站。 添加调试后,我发现激活视图被调用两次。第一次它按预期工作,但第二次激活密钥不再存在,因此出现错误。 让事情变得更复杂的是,它确实千载难逢。 为什么会出现这种情况呢?我怎样才能防止这种情况发生? 谢谢!
Hi and thank you for looking at my question.
When a user clicks activation link in their email, they get a token invalid error page. The user is activated and can use the site.
After adding debugging I see that the activation view is being called twice. The first time it works as expected, but the second time the activation key no longer exists so there is an error.
Just to make thing more complicated, it does work once in a very blue moon.
Why would this happen? How can I prevent this from happening?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于看到这篇文章的任何人:
当激活为 true 时,我添加了一个会话变量,然后在函数的开头检查它,如果是,则重定向到适当的 url。
这解决了问题。
For anyone who comes upon this post:
I added a session variable when the activation is true, and then checked for it in the beginning of the function, if so redirect to the appropriate url.
This solved the problem.