Various pre-launch fixes.
This commit is contained in:
parent
246f2023bc
commit
1c3273cee2
9 changed files with 29 additions and 39 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue