/malware-check/confirm: Alert admin on bad OTP

This commit is contained in:
David Ernst
2026-01-05 22:44:27 -08:00
parent 99822f820c
commit a5e790ac69

View File

@@ -21,7 +21,10 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
// Find matching check entry by OTP
const checkEntry = data.checks.find((entry: { otp?: string }) => entry.otp === otp)
if (!checkEntry) return res.status(404).json({ error: 'Invalid OTP' })
if (!checkEntry) {
await pushover('Malware check: Invalid OTP', `${election_id}: ${auth_token}\nOTP: ${otp}`)
return res.status(404).json({ error: 'Invalid OTP' })
}
// Update the specific check entry - add confirmation
const updatedChecks = data.checks.map((entry: { confirmations?: unknown[]; otp?: string }) => {