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() });
|
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
|
// Validate purchase
|
||||||
const validation = validateSeriesTicketPurchase(series, {
|
const validation = validateSeriesTicketPurchase(series, {
|
||||||
email,
|
email: canonicalEmail,
|
||||||
name,
|
name,
|
||||||
member,
|
member,
|
||||||
});
|
});
|
||||||
|
|
@ -80,7 +83,7 @@ export default defineEventHandler(async (event) => {
|
||||||
const registration = {
|
const registration = {
|
||||||
memberId: member?._id,
|
memberId: member?._id,
|
||||||
name,
|
name,
|
||||||
email: email.toLowerCase(),
|
email: canonicalEmail,
|
||||||
membershipLevel: member?.circle || "non-member",
|
membershipLevel: member?.circle || "non-member",
|
||||||
isMember: !!member,
|
isMember: !!member,
|
||||||
ticketType: ticketInfo.ticketType,
|
ticketType: ticketInfo.ticketType,
|
||||||
|
|
@ -115,7 +118,7 @@ export default defineEventHandler(async (event) => {
|
||||||
// Send confirmation email
|
// Send confirmation email
|
||||||
try {
|
try {
|
||||||
await sendSeriesPassConfirmation({
|
await sendSeriesPassConfirmation({
|
||||||
to: email,
|
to: canonicalEmail,
|
||||||
name,
|
name,
|
||||||
series: {
|
series: {
|
||||||
title: series.title,
|
title: series.title,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue