我为我使用设计web app
,现在我更改我的网络应用程序也响应mobile app
并且到目前为止forgot password
重置指令将发送到用户的电子邮件但现在我希望将密码发送到邮件以便用户可以检查他的邮件并使用密码。但我认为我做不到,因为密码正在encrypted
设计中,所以有人请告诉我如何通过邮件或其他方式获取密码,我可以将其用于我的移动应用程序。请帮我。
问问题
432 次
1 回答
0
"Forgot password" links usually send the user to a url with a single_access_token hash at the end. There, you identify the user and let them update their password to their liking. This way you do not irritate users who don't want you to have access to their passwords which they might also use for their bank accounts and social connection pages.
Another way is to set the password to a hash such as
user.password= @new_pass #MD5.digest(Time.now)[0..7]
# set password_confirmation and reset password token for "change password on login", too, if neccessary
user.save
In User model after_update :email_password_if_password_changed
if password field has changed, you can email their password using activemailer.
于 2012-11-09T09:53:34.300 回答