Current section: User Sessions 5 exercises

User Authentication and Session Management

Loading exercise


00:00 So we're just getting started with all this stuff. We've got a login page that Kelly built for us with a username and password. We don't have passwords in our database yet. We'll get to that soon. So as long as the username is filled in properly and we can find a user by that username, then we'll assume that the password is correct and we'll just let them in. But in the process of letting them in,

00:20 that means we're gonna be setting a cookie. So setting the session storage value for the user ID and then doing the commit session, the stuff that we've done before. So your task for here is just to resolve what the user submits here to a user object in Prisma.

00:39 If you can find it, then that's good. If you cannot, then we're gonna say, nope, there's an error. So we can display an error there. And then if that all is working, we have found a user, then you need to create or get the session for the cookie, from the cookie, and set the user ID in that session

00:59 and then commit that cookie in the response. So by the end of this, you should be able to get the cookie set in the response with the user ID in there. And we'll go to that point and then we can actually start loading the user based on that cookie. So have a good time with this section.