Skip to content

feat(auth): send password reset emails via SendGrid or SMTP - #1018

Merged
devanshi14malhotra merged 1 commit into
devanshi14malhotra:mainfrom
nimra06:feature/password-reset-email
May 28, 2026
Merged

devanshi14malhotra merged 1 commit into
devanshi14malhotra:mainfrom
nimra06:feature/password-reset-email

Conversation

@nimra06

@nimra06 nimra06 commented May 25, 2026

Copy link
Copy Markdown
Contributor

Description

Adds real email delivery for the existing password reset flow (forgot/reset API + auth UI).

  • New backend/email_service.py reads EmailConfig and sends reset links via Sendgrid (HTTP API) or SMTP (smtplib).
  • POST /api/v1/auth/forgot-password sends email when EMAIL_* is configured; reset_url is only returned in development when email is not configured (same security model as before for prod).
  • Extended EmailConfig and config/.env.example with SMTP settings and FRONTEND_ORIGIN for links in emails.
  • Frontend: “missing reset link” helper on auth page only on localhost (avoids confusing production users after a real email send).
  • Tests: test_email_service.py, test_forgot_password_email.py; fixed conftest.py to use the same db instance as backend.app.

Related Issue

Fixes #762

Type of Change

  • Bug Fix
  • Feature
  • Enhancement
  • Documentation

Testing

export GOOGLE_BOOKS_API_KEY=fake-key-for-testing JWT_SECRET_KEY=test-jwt-secret-key DATABASE_URL=sqlite:///:memory:
python3 -m pytest tests/test_email_service.py tests/test_forgot_password_email.py tests/test_password_reset.py -v

Add email_service and wire forgot-password to deliver reset links in
production. Keep dev-only reset_url when email is not configured.
Fixes devanshi14malhotra#762
@netlify

netlify Bot commented May 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for bibliodrift-dm ready!

Name Link
🔨 Latest commit 5972916
🔍 Latest deploy log https://app.netlify.com/projects/bibliodrift-dm/deploys/6a1408586ecf7f0008733263
😎 Deploy Preview https://deploy-preview-1018--bibliodrift-dm.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@devanshi14malhotra
devanshi14malhotra merged commit 041dd21 into devanshi14malhotra:main May 28, 2026
6 checks passed
@devanshi14malhotra devanshi14malhotra added level:advanced GSSoC'26 advanced level PR/issue gssoc:approved PR has been reviewed and is eligible for GSSoC points (for GSSoC'26) labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved PR has been reviewed and is eligible for GSSoC points (for GSSoC'26) level:advanced GSSoC'26 advanced level PR/issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Send password reset emails (SendGrid/SMTP)

2 participants