Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Forget Password via Email ID #8

Open
mahendra785 opened this issue Aug 20, 2024 · 1 comment
Open

Implement Forget Password via Email ID #8

mahendra785 opened this issue Aug 20, 2024 · 1 comment

Comments

@mahendra785
Copy link
Collaborator

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.

@D-Vspec
Copy link
Collaborator

D-Vspec commented Aug 20, 2024

Pseudocode: Implement Forget Password Feature

Objective:

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.

Steps:

1. Define the Password Reset Token Schema

  • Token Schema Structure:

    • Fields:
      • 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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants