Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed User Authentication With Express and Mongo!
You have completed User Authentication With Express and Mongo!
Preview
Add the program to compare the credentials a user supplies in the login form with user credentials in the Mongo database.
Security: Protecting against cross-site request forgery
Resources for adding password reset
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
To do this, let's start by
rewriting the login post route.
0:00
I'll open the index.JS file
inside the routes directory.
0:02
Currently, we just send the test
message logged in, I'll delete that.
0:07
To start, let's check to make sure
the user has supplied their email
0:12
and password.
0:15
Obviously if they leave one of those off
the form, we can't authenticate them and
0:16
we should spit out an error.
0:20
I'll use a conditional statement to
check to make sure the email and
0:23
password are coming in
through the request.
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up