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

PHP PHP User Authentication Adding Authentication to Your Application Working with Cookies

Aaditya Raj
PLUS
Aaditya Raj
Courses Plus Student 3,130 Points

Not able to login...

I am not able to log with the details. I am able to create user successfully as i checked it by recreating, But when tries to login with the login details ,i can't

Please help my snapshot link here:

https://w.trhou.se/eo40sj356t

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Aaditya Raj ! Looks to me like you're doing great, but you have a couple of very minor errors.

In your doLogin.php file on line 4, you typed:

$email = findUserByEmail(request()->get('email'));

But the variable was meant to be named $user:

$user = findUserByEmail(request()->get('email'));

Also, in functions.php on line 42, you have a minor typo which causes an error:

You wrote:

$response->header->setCookie($cookie);

But the header should be headers

$response->headers->setCookie($cookie);

That should clear up those two errors and allow you to login. Hope this helps! :sparkles: