diff --git a/pages/api/malware-check/confirm.ts b/pages/api/malware-check/confirm.ts index e1f65947..84919f65 100644 --- a/pages/api/malware-check/confirm.ts +++ b/pages/api/malware-check/confirm.ts @@ -22,7 +22,7 @@ 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) { - await pushover('Malware check: Invalid OTP', `${election_id}: ${auth_token}\nOTP: ${otp}`) + await pushover('Malware check, confirm: Invalid OTP', `${election_id}: ${auth_token}\nOTP: ${otp}`) return res.status(404).json({ error: 'Invalid OTP' }) } diff --git a/pages/api/malware-check/decrypt-success.ts b/pages/api/malware-check/decrypt-success.ts index a39eade0..6c830130 100644 --- a/pages/api/malware-check/decrypt-success.ts +++ b/pages/api/malware-check/decrypt-success.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import { firebase } from '../_services' +import { firebase, pushover } from '../_services' export default async (req: NextApiRequest, res: NextApiResponse) => { const { auth_token, election_id, otp } = req.body @@ -20,7 +20,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, decrypt success: Invalid OTP', `${election_id}: ${auth_token}\nOTP: ${otp}`) + return res.status(404).json({ error: 'Invalid OTP' }) + } // Update the specific check entry const updatedChecks = data.checks.map((entry: { otp?: string }) => { diff --git a/pages/api/malware-check/download.ts b/pages/api/malware-check/download.ts index bca1813d..b5598f88 100644 --- a/pages/api/malware-check/download.ts +++ b/pages/api/malware-check/download.ts @@ -25,7 +25,7 @@ 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) { - await pushover('Malware check: Invalid OTP', `${election_id}: ${auth_token}\nOTP: ${otp}`) + await pushover('Malware check, download: Invalid OTP', `${election_id}: ${auth_token}\nOTP: ${otp}`) return res.status(401).json({ error: 'Invalid OTP' }) }