Open mahendra785 opened 2 months ago
Add a "Forget Password" feature that allows users to reset their password by entering their email ID. Send a password reset link to the user's email, enabling them to set a new password securely.
Token Schema Structure:
userId
: The ID of the user requesting the password reset (e.g., String
, required)token
: Unique reset token (e.g., String
, required)expiresAt
: Expiration time for the token (e.g., Date
, required)Mongoose Schema Example:
const mongoose = require('mongoose');
const passwordResetSchema = new mongoose.Schema({
userId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true
},
token: {
type: String,
required: true
},
expiresAt: {
type: Date,
required: true
}
});
const PasswordReset = mongoose.model('PasswordReset', passwordResetSchema);
Add a "Forget Password" feature that allows users to reset their password by entering their email ID. Send a password reset link to the user's email, enabling them to set a new password securely.