Added Email integration for signup verify email and resend otp#225
Open
purvangIQUD wants to merge 7 commits into
Open
Added Email integration for signup verify email and resend otp#225purvangIQUD wants to merge 7 commits into
purvangIQUD wants to merge 7 commits into
Conversation
…mail-integration
| private readonly fromName: string; | ||
|
|
||
| constructor(private readonly configService: ConfigService) { | ||
| const apiKey = this.configService.getOrThrow<string>("BREVO_API_KEY"); |
Contributor
There was a problem hiding this comment.
Please add new env variable into .example.env file.
| return `otp-resend-limit:${flow}:${email.toLowerCase().trim()}`; | ||
| } | ||
|
|
||
| export function loadOtpResendLimitState( |
Contributor
There was a problem hiding this comment.
- Try catch missing
- No multiline comments
@purvangIQUD
| } | ||
|
|
||
| const storageKey = getResendLimitStorageKey(email, flow); | ||
| const raw = window.localStorage.getItem(storageKey); |
Contributor
There was a problem hiding this comment.
what are we storing in localStorage ?
| return Number.isFinite(parsed) && parsed > 0 ? parsed : 3; | ||
| })(); | ||
|
|
||
| const parsedResendWindowMinutes = Number(import.meta.env.VITE_RESEND_OTP_MINUTES); |
Contributor
There was a problem hiding this comment.
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"} |
Contributor
There was a problem hiding this comment.
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."; |
Contributor
There was a problem hiding this comment.
Lets move error to central file.
| const formattedOtp = escapeHtml(formatOtp(input.otp)); | ||
| const brandName = escapeHtml(this.fromName); | ||
|
|
||
| return `<!DOCTYPE html> |
Contributor
There was a problem hiding this comment.
can we handle this HTML in better way ?
| import { ConfigService } from "@nestjs/config"; | ||
| import { BrevoClient } from "@getbrevo/brevo"; | ||
|
|
||
| function escapeHtml(value: string): string { |
Contributor
There was a problem hiding this comment.
why can't we make this function as part of emailService ?
Contributor
Deploying console with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 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?
Steps to Test:
📸 Screenshots (if UI changes)
Attach before/after screenshots if applicable.
✅ Checklist