Project Challenge: Retrieving a User at Login
In this challenge, we will be modifying the login function to retrieve an inserted user from the database.
We'll cover the following
Problem statement #
In this challenge, we will modify the login
method so that it retrieves the required user
from the database instead of searching in the list.
📌 Note: we have already inserted one
user
in the database for you. This is the admin user. You can see the insertion on lines 31 to 41. You can use thisuser
to test out the modifiedlogin
method.
You will perform the following tasks:
-
Modify the
login
method to check for theuser
in the database and then authenticate it. -
Next, instead of storing the
user
object in thesession
, only store theid
of the user in thesession
.
Get hands-on with 1200+ tech skills courses.