fix: use canonical member email for series registration when authenticated
This commit is contained in:
parent
44f3ee8c8c
commit
ccd1d0783a
1 changed files with 6 additions and 3 deletions
|
|
@ -44,9 +44,12 @@ export default defineEventHandler(async (event) => {
|
|||
member = await Member.findOne({ email: email.toLowerCase() });
|
||||
}
|
||||
|
||||
// Resolve canonical email: use authenticated member's email if available
|
||||
const canonicalEmail = member ? member.email : email.toLowerCase();
|
||||
|
||||
// Validate purchase
|
||||
const validation = validateSeriesTicketPurchase(series, {
|
||||
email,
|
||||
email: canonicalEmail,
|
||||
name,
|
||||
member,
|
||||
});
|
||||
|
|
@ -80,7 +83,7 @@ export default defineEventHandler(async (event) => {
|
|||
const registration = {
|
||||
memberId: member?._id,
|
||||
name,
|
||||
email: email.toLowerCase(),
|
||||
email: canonicalEmail,
|
||||
membershipLevel: member?.circle || "non-member",
|
||||
isMember: !!member,
|
||||
ticketType: ticketInfo.ticketType,
|
||||
|
|
@ -115,7 +118,7 @@ export default defineEventHandler(async (event) => {
|
|||
// Send confirmation email
|
||||
try {
|
||||
await sendSeriesPassConfirmation({
|
||||
to: email,
|
||||
to: canonicalEmail,
|
||||
name,
|
||||
series: {
|
||||
title: series.title,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue