Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby User Authentication with Rails Password Hashing and Sign In Creating the Sessions Controller

Yang Bo
PLUS
Yang Bo
Courses Plus Student 8,503 Points

what's wrong in here?

I wrote the code as below for blank which I need: "authenticate(params[:password])"

if user && user.authenticate(params[:password])

I'm not sure what's wrong, it is always show incorrect. btw, could you give the notification for user? I just saw the incorrectly, but I can't see any notification.

8 Answers

Yang Bo
PLUS
Yang Bo
Courses Plus Student 8,503 Points

it is fixed. just used method user.authenticate, doesn't has any parameter. but it is weird, it is check submitted password, no parameter to calling authenticate, just checking email? Jason Seifer

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Yang Bo I'm not sure I understand the question exactly. You should be calling the authenticate method with params[:password]. Check out the documentation on the subject for more information. It should take a single parameter which is the unencrypted password.

Yang Bo
Yang Bo
Courses Plus Student 8,503 Points

yes, but the correctly answer is

user.authenticate

it is without params[:password]

hey im having the same issue, im not sure what to try anymore i been working on this for 5 hours going though other websites and still can seem to understand it

Yang Bo
Yang Bo
Courses Plus Student 8,503 Points

just use user.authenticate, don't pass any params...

ive try that and its not working ,

just

" user.authenicate "

Yang Bo
Yang Bo
Courses Plus Student 8,503 Points

or please try

if user & user.authenicate(params[:password]) (i think it is correct, but the right awnser is next) or if user & user.authenicate (it is my previous right awnser when during course)

it didnt work

i know that's the correct. but its not working it should just be

user.authenticate

but its not working? i dont understand why its not working , the params shouldnt have to be used in the answer.

thank you, i guess its just not my day!

Yang Bo it final worked !!!!! thank you so much :)