Cakephp 帐户激活电子邮件 - 在服务器上找不到地址
对于我们的网站,我们使用以下教程设置帐户激活电子邮件(在 cakephp 中):
http://www.jonnyreeves.co.uk/2008/06/cakephp-activating-user-account-via-email/
在我们的实时网站上,似乎激活在大多数情况下有效,但是有些人在单击激活电子邮件链接激活其帐户时收到以下错误:
错误:在此服务器上找不到请求的地址“/users/activate/36/10a1a794”。
这对我来说很奇怪,因为链接看起来很好:“users”控制器,“activate”操作,user_id = 36,哈希码 = 0a1a794。不知道为什么会发生这个错误。我读到的一件事是清除缓存文件夹中的文件,这似乎没有改变任何东西。请帮忙谢谢!
For our website, we set up the account activation email with the following tutorial (in cakephp):
http://www.jonnyreeves.co.uk/2008/06/cakephp-activating-user-account-via-email/
On our live site, it seems that the activation works for the most part, however some people are receiving the following error when clicking on the activation email link to activate their account:
Error: The requested address '/users/activate/36/10a1a794' was not found on this server.
This is odd to me because the link looks fine: "users" controller, "activate" action, user_id = 36, and hash code = 0a1a794. Not sure why this error is happening. One thing I read is to clear the files in the cache folder and that didn't seem to change anything. Please help thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
激活哈希的有效性有限(同一天)。
因此,如果在任何一个月的 1 号发送激活电子邮件,则有效期至 1 号晚上 11:59。该链接在中午 12:00(严格来说是每月 2 日)之后将无法使用。
希望有帮助。
The activation hash has limited validity(same day).
So if send the activation email on 1st of any month, it will be valid till 11:59pm of 1st. The link wont work after 12:00am(technically 2nd of the month).
Hope that helps.
是的,这就是 Josh R 所说的,哈希值是在同一天计算的,这是一个非常糟糕的主意。
您应该停止对日期进行哈希处理或验证两个值:一个用于今天的日期,一个用于昨天的日期。
另外,建议:不要只是去那里复制文件,尝试从中学习一些东西,请按照你的方式去做。你会学到更多。
Yes, that's what Josh R said, the hash is computed for the same day and this is a VERY bad idea.
You should either stop hashing the date or validate against two values: one for today's date, one for yesterday's date.
Also, a recommendation: don't just go there and copy the files, try to learn something from it and please, do it your way. You'll learn a lot more.