Implementing Forgot Password and Reset Password Flows
00:00 Ever since I started using a password manager, I haven't really had too much trouble with remembering my password problem, but a lot of people do still have this problem, and sometimes I try to log into something that I haven't logged into a long time ago, and yeah, I need to reset my password.
00:16 So having the forgot password or reset password flow is very, very important, and that's what you're gonna be implementing here. Now, this is gonna require that we send an email to the user to verify that they are the one requesting a password change, and so this is gonna go through our verification process,
00:33 just like when we were onboarding a new user. So we're gonna send them a code, and they'll come back to our reset password page where they can set their new password and we'll verify that their code is valid and all of that stuff. So Kelly did a couple of things for us in our verify utility here.
00:53 She added a is code valid, she added a prepare verification function here, but all of this stuff should be pretty familiar to what we've already done, and also this get redirect to URL, that will also be a handy piece to this. And so we're gonna be adding a new verification type
01:13 to this as well. So you're gonna be doing a couple of things within verify, but most of the work that you're gonna be doing will be happening in the reset password module for that route, as well as the forgot password route. So in forgot password,
01:28 you're gonna generate the code and send the email, and then in the reset password, you're gonna be verifying the code using the API that is put together here. Like in particular, what's pretty cool about the way that this works
01:45 is now the verification process happens in the route that is responsible for that verify. So now verify is much less concerned about the specifics of what happens after the user is verified, and that can be pushed to the different routes that are the thing that's interested
02:04 in the user being verified. So you're gonna be implementing a handle verification in the reset password, and then adding that to this list of things that can happen when verification is successful. So that's what you're gonna be doing in this exercise. I think you're gonna have a good time with it. It's pretty cool that we already have all of this verification stuff set up,
02:23 so you can just go forth and add a bunch of different things that require verification. So we're gonna do reset password. Have a good time.