feat(api): show the verification code in the SES mailbox
CI / checks (pull_request) Failing after 12m24s

This commit is contained in:
Zakaria
2026-10-24 01:23:56 -04:00
parent 4bc8da6ee1
commit d457c08b12
3 changed files with 22 additions and 0 deletions
@@ -125,10 +125,18 @@ function messageToResource(message: FlociSesMessage): CloudResource {
htmlBody: message.Body?.html_part ?? null,
rawData: message.RawData ?? null,
messageType: raw ? 'raw' : 'simple',
code: findCode(message.Body?.text_part ?? message.Body?.html_part),
},
}
}
// Matches the wording of Cognito's default and most custom messages: "Your verification code is 123456."
const CODE_PATTERN = /\bcode\s+is:?\s*(?:<[^>]+>\s*)*(\d{4,8})\b/i
function findCode(body: string | null | undefined): string | null {
return body?.match(CODE_PATTERN)?.[1] ?? null
}
function filterBySearch(resources: CloudResource[], search?: string): CloudResource[] {
const normalized = search?.trim().toLowerCase()
if (!normalized) return resources