mirror of
https://github.com/Sea-Haven-Industries/seahaven-ap.git
synced 2026-10-01 20:13:22 +00:00
17 lines
496 B
JavaScript
17 lines
496 B
JavaScript
const ALLOWED_DOMAINS = new Set(["seahavenind.com", "seahaven.com"]);
|
|
|
|
export async function handler(event) {
|
|
const email = String(event?.request?.userAttributes?.email ?? "")
|
|
.trim()
|
|
.toLowerCase();
|
|
const at = email.lastIndexOf("@");
|
|
const domain = at >= 0 ? email.slice(at + 1) : "";
|
|
|
|
if (!ALLOWED_DOMAINS.has(domain)) {
|
|
throw new Error("Email domain is not allowed");
|
|
}
|
|
|
|
event.response.autoConfirmUser = true;
|
|
event.response.autoVerifyEmail = true;
|
|
return event;
|
|
}
|