-
Notifications
You must be signed in to change notification settings - Fork 4
UUID API
A universal unique identifier (UUID) is a standard of generating identifiers, standardized by the Open Software Foundation (OSF).
The intent of UUIDs is to be able to generate unique identifiers in a distributed system UUID is meant for generating UUIDs from truly-random or pseudo-random unique numbers.
npm install uuid
In order to generate the random number unique value and pass to the URL of forget password
/users/forgot Here we are generating unique random number by using UUID API
/users/reset/:token(GET) Generated token is passed as a parameter request to the forgot mail /users/reset/:token(POST) The same UUID is sent to update the password to corresponding user
const token = uuidv4();
console.log(token);
let mailOptions =
###/users/reset/:token(GET) Use token and send to URL of mail ###/users/reset/:token(POST) Use the generated token to keep get details of the user and update password
Insert into the token table generated token and 4 digit user id
More information can be obtained from https://www.npmjs.com/package/uuid