I currently have in my application the ability for a user to create an account with a username and password and then have an email sent to them.
In order to generate a more secure log in, I wish for a random password to be generated and then in the email sent to the user the password is contained there.
I am just wondering how I would do this. I have a password_hash and salt in my database so it would require having the random string assigned there.
I understand that I would have to have in my model something like
before_save :assign_password
and then a
def assign_password
stuff
end
Is this all I would need and it would assign to the password
field? what would I include in the def assign_password?