Various pre-launch fixes.
Some checks failed
Test / vitest (push) Successful in 14m0s
Test / playwright (push) Failing after 20m2s
Test / Notify on failure (push) Successful in 3s

This commit is contained in:
Jennie Robinson Faber 2026-05-22 18:53:07 +01:00
parent 246f2023bc
commit 1c3273cee2
9 changed files with 29 additions and 39 deletions

View file

@ -27,16 +27,13 @@ export default defineEventHandler(async (event) => {
throw createError({ statusCode: 400, statusMessage: 'This invitation has already been accepted' })
}
// Single-use enforcement
if (!decoded.jti || decoded.jti !== preReg.magicLinkJti || preReg.magicLinkJtiUsed) {
// Match the jti so that re-invite (which rotates the jti) kills old links.
// The burn happens in accept.post.js once a Member is created — keeps verify
// idempotent so the form survives a refresh.
if (!decoded.jti || decoded.jti !== preReg.magicLinkJti) {
throw createError({ statusCode: 401, statusMessage: 'Invalid or expired invitation link' })
}
// Burn the token
await PreRegistration.findByIdAndUpdate(preReg._id, {
$set: { magicLinkJtiUsed: true }
})
return {
preRegistrationId: preReg._id,
name: preReg.name,