feat(SW-2605): confirmation page only valid for 1 minute for the session

This commit is contained in:
Michael Zetterberg
2025-05-06 12:04:00 +02:00
parent e0fe5ff0d5
commit c6a0ce86df
9 changed files with 73 additions and 21 deletions

View File

@@ -4,6 +4,8 @@ import { getMembershipNumber } from "@/server/routers/user/utils"
import { createCounter } from "@/server/telemetry"
import { router, safeProtectedServiceProcedure } from "@/server/trpc"
import { encrypt } from "@/utils/encryption"
import {
addPackageInput,
cancelBookingsInput,
@@ -71,7 +73,12 @@ export const bookingMutationRouter = router({
metricsCreateBooking.success()
return verifiedData.data
const expire = Math.floor(Date.now() / 1000) + 60 // 1 minute expiry
return {
booking: verifiedData.data,
sig: encrypt(expire.toString()),
}
}),
priceChange: safeProtectedServiceProcedure
.concat(refIdPlugin.toConfirmationNumber)

View File

@@ -244,7 +244,12 @@ export const bookingQueryRouter = router({
metricsGetBookingStatus.success()
return verifiedData.data
const expire = Math.floor(Date.now() / 1000) + 60 // 1 minute expiry
return {
booking: verifiedData.data,
sig: encrypt(expire.toString()),
}
}),
createRefId: serviceProcedure
.input(createRefIdInput)