Skip to content

Added Email integration for signup verify email and resend otp#225

Open
purvangIQUD wants to merge 7 commits into
mainfrom
feature/email-integration
Open

Added Email integration for signup verify email and resend otp#225
purvangIQUD wants to merge 7 commits into
mainfrom
feature/email-integration

Conversation

@purvangIQUD

@purvangIQUD purvangIQUD commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

📝 What does this change do?

Briefly explain the purpose of this MR.

added email integration using Brevo for singup verify email and resent otp

🔗 Related Issue / Task


🧪 How was this tested?

  • Unit tested
  • Manually tested
  • Not tested (explain why)

Steps to Test:

  1. NONE

📸 Screenshots (if UI changes)

Attach before/after screenshots if applicable.


⚠️ Impact / Risks

  • Any breaking changes? NO
  • Any performance impact? NO
  • Any migration required? NO

✅ Checklist

  • Code is self-reviewed
  • Follows project conventions
  • No unnecessary logs / debug code
  • Documentation updated (if needed)

@purvangIQUD purvangIQUD self-assigned this Jun 22, 2026
private readonly fromName: string;

constructor(private readonly configService: ConfigService) {
const apiKey = this.configService.getOrThrow<string>("BREVO_API_KEY");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add new env variable into .example.env file.

return `otp-resend-limit:${flow}:${email.toLowerCase().trim()}`;
}

export function loadOtpResendLimitState(

@nitin-iqudtek nitin-iqudtek Jun 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

const storageKey = getResendLimitStorageKey(email, flow);
const raw = window.localStorage.getItem(storageKey);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are we storing in localStorage ?

return Number.isFinite(parsed) && parsed > 0 ? parsed : 3;
})();

const parsedResendWindowMinutes = Number(import.meta.env.VITE_RESEND_OTP_MINUTES);

@nitin-iqudtek nitin-iqudtek Jun 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any better to import the env varialbe ? To improve the code readability.

}}
type="text"
inputMode="numeric"
autoComplete={index === 0 ? "one-time-code" : "off"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid using static strings here, can we have constant for it ?


return GENERIC_ERROR_MESSAGE;
if (status === 429) {
return "Too many requests. Please try again later.";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets move error to central file.

const formattedOtp = escapeHtml(formatOtp(input.otp));
const brandName = escapeHtml(this.fromName);

return `<!DOCTYPE html>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we handle this HTML in better way ?

import { ConfigService } from "@nestjs/config";
import { BrevoClient } from "@getbrevo/brevo";

function escapeHtml(value: string): string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we make this function as part of emailService ?

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Deploying console with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7d0c71e
Status: ✅  Deploy successful!
Preview URL: https://4fa92b08.core-6vy.pages.dev
Branch Preview URL: https://feature-email-integration.core-6vy.pages.dev

View logs

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.

Verify email functionality

2 participants