Switch all db storage to session storage
All checks were successful
Build And Deploy / build-and-deploy (push) Successful in 1m27s

Only affects CapAdapter, challenge.ts, and redeem.ts.
This commit is contained in:
badblocks 2026-02-07 18:07:50 -08:00
parent 1fbcbf772a
commit 6c56b203d3
Signed by: badblocks
SSH key fingerprint: SHA256:hEcM6BP4hKm9F7WsomNuXSBpPn2BSDnFzPSl3y1NerQ
4 changed files with 56 additions and 87 deletions

View file

@ -4,7 +4,7 @@ import type { ActionAPIContext } from "astro:actions";
import validator from "validator";
import SmsClient from "@lib/SmsGatewayClient.ts";
import Otp, { verifyOtp } from "@lib/Otp.ts";
import CapServer from "@lib/CapAdapter";
import { createCap } from "@lib/CapAdapter";
import {
OTP_SUPER_SECRET_SALT,
ANDROID_SMS_GATEWAY_RECIPIENT_PHONE,
@ -81,10 +81,12 @@ const submitActionDefinition = {
});
}
const cap = createCap(context.session ?? null);
if (
!(
/^[a-fA-F0-9]{16}:[a-fA-F0-9]{30}$/.test(input.captcha) &&
(await CapServer.validateToken(input.captcha))
(await cap.validateToken(input.captcha))
)
) {
throw new ActionError({