When I amended my registration page, I included the digest to encrypt the password in the database.
If someone forgets their password, how do I get this mailed back to the user?
The action is as follows:
def remind
@title = "Remind Me!"
if param_posted?(:user)
email = params[:user][:email]
user = User.find_by_email(email)
If user
UserMailer.deliver_reminder(@user)
flash[:notice] = "Reminder sent."
redirect_to :action => "index", :controller => "site"
else
flash[:notice] = "There is no user with that email address."
end
end
end
This then calls the reminder part of UserMailer.deliver and sends the user their username and password.
This template shows… Hello, You have just requested your login details. Please see below:
Username: <%= @user.username %
Password: <%= @user.password %>
Thing is, with the password, as-is, it just prints the encrypted string, so is no use to a user.
AT the moment I only mail out the username, as the password at the moment isn’t helpful.
Is there a way to decrypt for the purposes of reminding someone?
Many Thanks... ![]()