课程: React: Authentication

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Adding a reset password server endpoint

Adding a reset password server endpoint - React.js教程

课程: React: Authentication

Adding a reset password server endpoint

- Okay, now that we have our password reset landing page, the only thing that we have left to implement in the reset password flow is the end point that we can send the new password and verification code to in order to actually reset the user's password. So here's what that's going to look like: Inside the routes folder, we're going to create a new file for this route, and we're going to call the route the resetPasswordRoute.js. Okay, we have our forgotPasswordRoute and resetPasswordRoute. And we're going to start off by importing a few things up at the top as usual. We're going to say import bcrypt. From bcrypt, we're going to be using this to hash the user's new password. And then the only other thing we're going to import is our getDbConnection function, so getDbConnection from db. And then our function is going to look like this. We're going to say export const, resetPasswordRoute, The path for this route,…

内容