Tank Auth 忘记密码不起作用
我使用 CodeIgniter + Tank Auth。只有代码 http://localhost/XXXXXXXX/auth/forgot_password 不起作用。 结果总是: “您的激活密钥不正确或已过期。请再次检查您的电子邮件并按照说明进行操作。”
注册和激活就OK了。
I use CodeIgniter + Tank Auth. Only the code http://localhost/XXXXXXXX/auth/forgot_password doesn't work.
The result always is:
"Your activation key is incorrect or expired. Please check your email again and follow the instructions."
The registration and activation are all right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
一些可能的问题:
$config['forgot_password_expire']
。您的电子邮件中可能链接到了错误的网址。
这看起来不对:
http://localhost/XXXXXXXX/auth/forgot_password
应该是这样的:
http://localhost/auth/forgot_password/XXXXXXXX
不阻止您使用 Tank Auth,但使用后我建议您尝试 Ion_Auth 如果你还处于早期阶段。我相信它也用在 PyroCMS 中,如果这增加了任何信用的话。
Some likely problems:
$config['forgot_password_expire']
in Tank Auth.You may be linking to the wrong URL in your email.
This doesn't look right:
http://localhost/XXXXXXXX/auth/forgot_password
It should be something like:
http://localhost/auth/forgot_password/XXXXXXXX
Not to discourage you from using Tank Auth, but having used it I can recommend trying Ion_Auth if you are still in the early stages. I believe it's used in PyroCMS as well if that adds any credit.
如果 URL 中的 XXXXXXXX 表明您在 /auth/ 之前有一个额外的 URI 段,则应将其更改
为:
注意 $this->uri->segment() 中的不同数字。在 /auth/ 之前有一个额外的段,您的用户 ID 和激活码将作为第四和第五段中的参数传递(而不是 Tank Auth 假定的第三和第四段)。
If the XXXXXXXX in your URL is indicating that you have an extra URI segment before /auth/, you should change this:
to this:
Note the different numbers in $this->uri->segment(). With an extra segment before /auth/, your user id and activation code will be passed as parameters in the 4th and 5th segment (rather than the 3rd and 4th that Tank Auth assumes).
它可能是您数据库中的时间戳
在用户模型函数“can_reset_password”中
使用 UNIX_TIMESTAMP(new_password_requested)
您可以回显 $user_id 和 $new_pass_key 如果它们正确,那么问题出在时间比较上。
要修复 url 以始终获取
时间戳的最后两段,请尝试对用户模型中的函数 Reset_password 执行此操作
it could be the time stamp in your database
in user model function "can_reset_password"
uses a UNIX_TIMESTAMP(new_password_requested)
you could echo $user_id and $new_pass_key if they are correct then the problem is with time comparison.
to fix the the url to always get the last two segments
for the time stamp try this for the function reset_password in users model
在主index.php 中,您必须定义一个时区。示例:
这将确保以下检查具有相同时区的所有日期
In the main index.php, you have to define a time zone. Example:
this will ensure that the following check has all the dates with the same time zone