refactor: clean up code formatting and improve readability in audit and email service files

This commit is contained in:
Sascha 2026-09-20 14:42:40 +02:00
parent 47b23001ec
commit ed129ee56d
4 changed files with 26 additions and 12 deletions

View File

@ -1,7 +1,10 @@
import express from 'express'
import rateLimit from 'express-rate-limit'
import { body, validationResult } from 'express-validator'
import { sendAuditRequestEmail, sendQuickcheckRequestEmail } from '../services/emailService.js'
import {
sendAuditRequestEmail,
sendQuickcheckRequestEmail,
} from '../services/emailService.js'
const router = express.Router()
@ -50,11 +53,14 @@ const validateQuickcheckRequest = [
]
const validateRequest = (req, _res, next) => {
const validators = req.body.formType === 'quickcheck'
? validateQuickcheckRequest
: validateAuditRequest
const validators =
req.body.formType === 'quickcheck'
? validateQuickcheckRequest
: validateAuditRequest
Promise.all(validators.map((validator) => validator.run(req))).then(() => next())
Promise.all(validators.map((validator) => validator.run(req))).then(() =>
next(),
)
}
router.post('/', auditLimiter, validateRequest, async (req, res) => {
@ -69,7 +75,14 @@ router.post('/', auditLimiter, validateRequest, async (req, res) => {
})
}
const { formType = 'audit', name, email, businessConfirmation, gdprConsent, website } = req.body
const {
formType = 'audit',
name,
email,
businessConfirmation,
gdprConsent,
website,
} = req.body
if (website) {
console.warn('Honeypot triggered, discarding submission.')

View File

@ -35,7 +35,9 @@ function getTransporter() {
* when it is used in Subject or Reply-To.
*/
function singleLine(value) {
return String(value).replace(/[\r\n]+/g, ' ').trim()
return String(value)
.replace(/[\r\n]+/g, ' ')
.trim()
}
/** Minimal HTML escaping - the payload is attacker-controlled by definition. */

View File

@ -365,22 +365,22 @@ export interface TextConfig {
problem: {
title: string;
intro: string;
items: { text: string }[];
items: { text: string; }[];
outro: string;
};
deliverable: {
title: string;
intro: string;
items: { title: string; text: string }[];
items: { title: string; text: string; }[];
};
process: {
title: string;
steps: { title: string; text: string }[];
steps: { title: string; text: string; }[];
};
limits: {
title: string;
intro: string;
items: { text: string }[];
items: { text: string; }[];
outro: string;
};
form: {

View File

@ -258,7 +258,6 @@
&__features {
grid-template-columns: repeat(3, 1fr);
}
}
@media (prefers-reduced-motion: reduce) {