swarooppatilx / scruter

Scruter is a local classifieds and community site designed to bring people together for buying, selling, and exchanging goods and services.
https://scruter.vercel.app
GNU General Public License v3.0
28 stars 131 forks source link

[Feat] πŸš€ Issue: Seller Signup Implementation – Frontend & Backend #311

Closed ShivanshPlays closed 4 weeks ago

ShivanshPlays commented 1 month ago

πŸ“ Description

This issue tracks the complete implementation of the Seller Signup functionality, covering both frontend pages and backend logic. The seller signup will follow a secure OTP-based email verification process to ensure valid registrations.


πŸ“Œ Key Objectives

  1. Frontend Pages and Forms

    • Create the Seller Signup Form for collecting basic information (e.g., name, email, password).
    • Upon form submission, make a request to the backend to create a new user in the database and send an OTP to the provided email address.
    • Implement a second form to input the OTP received via email.
    • Ensure smooth user experience with appropriate success and error messages.
  2. OTP-based Email Verification

    • Generate a 6-digit OTP and send it to the seller’s email upon form submission.
    • Create a reusable email utility function to handle OTP email sending using Nodemailer.
    • Ensure proper error handling for email delivery issues (e.g., invalid email or delivery failure).
  3. Backend Server Actions

    • Implement server-side logic to create a new user in the database using Prisma ORM.
    • Develop API routes to:
      • Send OTP to the email address after signup.
      • Verify the OTP submitted by the user.
      • Mark the user as validated upon successful OTP verification.
    • Handle edge cases (e.g., duplicate users, expired OTPs, incorrect OTPs).

πŸ› οΈ Requirements

  1. Frontend Implementation

    • A multi-step signup form with:
      • Step 1: Collect user information (name, email, password).
      • Step 2: OTP input form (after OTP is sent to the email).
    • Use appropriate form validation and display error messages as needed.
  2. Backend Logic

    • Create a new user in the MongoDB database using Prisma after the first form submission.
    • Send an OTP via Nodemailer to the registered email.
    • Verify OTP submission using backend routes and validate the user account.
  3. Error Handling & Notifications

    • Display success and error messages using React Hot Toast on the frontend.
    • Ensure the backend handles issues like:
      • Duplicate email addresses.
      • Incorrect OTPs.
      • Expired OTPs.

Screenshots

No response

Checklist