authenticate not working in rails

41 views
Skip to first unread message

amvis

unread,
Mar 30, 2012, 2:52:49 AM3/30/12
to rubyonra...@googlegroups.com
i have this code

         user_name=auth_decoded[0]
          password=auth_decoded[1]
          @user = User.find_by_email(user_name)
          if (@chkuser= (@user && @user.authenticate(password))) 


The above snippet is not working, any solution...?

Thank you
vishnu

Aaron Schmitz

unread,
Mar 30, 2012, 4:25:48 AM3/30/12
to Ruby on Rails: Talk
i don't know where "user_name" comes from but i think you are passing
in user_name where you search for the email.

"@user = User.find_by_email(user_name)"

change it to:

"@user = User.find_by_email(user_email)" or however your variable is
called

greets

amvis

unread,
Mar 30, 2012, 6:56:21 AM3/30/12
to rubyonra...@googlegroups.com


>On Friday, 30 March 2012 04:25:48 UTC-4, Aaron Schmitz wrote:
>i don't know where "user_name" comes from but i think you are passing
>in user_name where you search for the email.
 
 i think thats not a pblm, bcz here user_name basically that is an email address for login purpose, Have any another issues with that code? 

Thank you
vishnu

amvis

unread,
Mar 30, 2012, 8:18:13 AM3/30/12
to rubyonra...@googlegroups.com
user_name=auth_decoded[0]
          password=auth_decoded[1]
          @user = User.find_by_email(user_name)
          if (@chkuser= (@user && @user.authenticate(password))) 


in  the above code, this  @user.authenticate(password)  return false......

Why like this....?
Thank you
vishnu
Reply all
Reply to author
Forward
0 new messages