Skip to content

Authentication fixes and email configuration resend - #29

Merged
li4nee merged 2 commits into
mainfrom
staging
Jul 13, 2026
Merged

li4nee merged 2 commits into
mainfrom
staging

Conversation

@li4nee

@li4nee li4nee commented Jul 13, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added self-service signup with company and administrator account creation.
    • Added email verification and password reset workflows.
    • Added email verification status to user profiles and login protection for unverified accounts.
    • Added Redis-backed API key caching and cache invalidation.
    • Added a background alerting worker service.
    • Improved alert emails with formatted details and safer HTML handling.
  • Bug Fixes
    • Revoked or deactivated API keys are now invalidated promptly.
  • Chores
    • Migrated email delivery from SMTP to Resend.

li4nee and others added 2 commits July 13, 2026 10:41
- Introduced VerifyEmailDTO for email verification requests.
- Updated user repository to exclude sensitive fields from queries.
- Enhanced auth routes to include signup, resend verification email, and verify email endpoints.
- Implemented email verification logic in AuthService, including token generation and sending verification emails.
- Added password reset functionality with token generation and email notifications.
- Created utility functions for building email templates and sending emails via Resend API.
- Implemented caching for API keys to improve performance and reduce database load.
- Updated client service to handle user signup and client creation with email verification.
- Added error handling for unverified email during login attempts.
- Introduced new error types for better error management.
feat(auth): add email verification and password reset functionality
@li4nee
li4nee merged commit 2f6d683 into main Jul 13, 2026
2 checks passed
@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c69bcb1-f36b-4b07-86fb-19d8c8ba9216

📥 Commits

Reviewing files that changed from the base of the PR and between c69fad3 and 5e23f5c.

⛔ Files ignored due to path filters (1)
  • server/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (31)
  • server/docker-compose.yml
  • server/package.json
  • server/src/modules/alerting/services/channels/email.channel.ts
  • server/src/modules/auth/contracts/IAuthService.contract.ts
  • server/src/modules/auth/controllers/auth.controller.ts
  • server/src/modules/auth/dtos/emailOnly.dto.ts
  • server/src/modules/auth/dtos/resetPassword.dto.ts
  • server/src/modules/auth/dtos/userResponse.dto.ts
  • server/src/modules/auth/dtos/verifyEmail.dto.ts
  • server/src/modules/auth/repos/user.repo.ts
  • server/src/modules/auth/routes/auth.route.ts
  • server/src/modules/auth/services/auth.service.ts
  • server/src/modules/client/contracts/IApiKeyService.contract.ts
  • server/src/modules/client/contracts/IClientService.contract.ts
  • server/src/modules/client/controllers/client.controller.ts
  • server/src/modules/client/dependencies/client.dependency.ts
  • server/src/modules/client/dtos/signup.dto.ts
  • server/src/modules/client/repos/apiKeyBase.repo.ts
  • server/src/modules/client/repos/apikey.repo.ts
  • server/src/modules/client/services/apiKey.service.ts
  • server/src/modules/client/services/client.service.ts
  • server/src/shared/config/global.config.ts
  • server/src/shared/infra/cache/apiKeyCache.ts
  • server/src/shared/infra/cache/authTokenCache.ts
  • server/src/shared/infra/db/mongo/models/user.model.ts
  • server/src/shared/middleware/validateApiKey.middleware.ts
  • server/src/shared/typings/error.typings.ts
  • server/src/shared/utils/authEmailTemplates.utils.ts
  • server/src/shared/utils/emailVerification.utils.ts
  • server/src/shared/utils/html.utils.ts
  • server/src/shared/utils/resendMailer.utils.ts

📝 Walkthrough

Walkthrough

The server adds public signup, email verification, password recovery, Redis-backed API-key caching, Resend-based email delivery, an alerting worker service, and related validation, configuration, persistence, and authorization updates.

Changes

Authentication and email platform

Layer / File(s) Summary
Shared contracts and infrastructure
server/src/shared/..., server/src/modules/auth/dtos/*, server/src/shared/infra/db/...
Adds verification state, token and API-key caches, Resend utilities, authentication email templates, validation schemas, updated configuration, and an email-not-verified error.
Signup and authentication recovery flows
server/src/modules/auth/..., server/src/modules/client/...
Adds signup, verification, password reset routes and handlers; creates users and clients during signup; sends verification email; blocks unverified login; and implements token-based recovery.
API-key cache integration
server/src/modules/client/..., server/src/shared/middleware/...
Caches API-key lookups, invalidates entries on revocation or client deactivation, and updates middleware to consume the cached result shape.
Alerting email and runtime wiring
server/src/modules/alerting/..., server/docker-compose.yml, server/package.json
Replaces Nodemailer alert delivery with escaped HTML sent through Resend, removes Nodemailer entries and an obsolete script, and adds the alerting worker service.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant AuthController
  participant AuthService
  participant AuthTokenCache
  participant Resend
  Client->>AuthController: submit signup or recovery request
  AuthController->>AuthService: validate and invoke authentication flow
  AuthService->>AuthTokenCache: store or consume hashed token
  AuthService->>Resend: send verification or reset email
  Resend-->>Client: deliver email link
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch staging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Successfully merging this pull request may close these issues.

1 participant