hi every body…
I need help…
I have the following code in a user model. But when i try to autenticate
user always returns nil, my session controller calls the autenticate
I proves comparing only the database password with new encrypted
but always returns nil. The database password was encryted with the same
encrypt method. I dont know what i need to do.
TNKS a lot…
Authenticates a user by their login name and unencrypted password.
the user or nil.
def self*.authenticate(login, password)
u = find_by_login(login) # need to get the salt and user_password
u && u.authenticated?(password) ? u :* nil
Encrypts some data with the salt.
def self*.encrypt(password, salt)
Encrypts the password with the user salt
user_password == encrypt(password)