Fix contatti + rinomina servizi + orario sabato
- Contatti: rate-limit per IP reale (X-Forwarded-For) invece dell'IP del proxy Traefik, condiviso da tutti; controllo spostato dopo la validazione così bot/honeypot non consumano la quota. Honeypot rinominato da "website" a "hp_field" per non farlo riempire dall'autofill del browser (falsi 400). - Servizi: "Performance Class" -> "Class" (titolo/card/H1/footer); migrazione DB invertita e guardata. - One to One: migrazione titolo prod "Personal training" -> "One to One". - Footer: orario sabato 8-17 (non 8-19), seed + migrazione guardata. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,7 @@ describe('validateContact', () => {
|
||||
});
|
||||
|
||||
it('rifiuta honeypot compilato', () => {
|
||||
expect(validateContact({ ...good, website: 'spam.com' }).ok).toBe(false);
|
||||
expect(validateContact({ ...good, hp_field: 'spam.com' }).ok).toBe(false);
|
||||
});
|
||||
|
||||
it('rifiuta messaggi oltre 5000 caratteri', () => {
|
||||
|
||||
@@ -113,18 +113,18 @@ describe('schema content_blocks e ruoli', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('corregge il titolo Performance Class rimasto troncato a "Class"', () => {
|
||||
it('riporta il titolo del servizio a "Class" (inverte Performance Class)', () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'il-db-pc-'));
|
||||
const path = join(dir, 'test.db');
|
||||
try {
|
||||
// DB con il vecchio valore troncato.
|
||||
// DB con il vecchio valore normalizzato "Performance Class".
|
||||
const db1 = createDb(path);
|
||||
db1.prepare("UPDATE content_blocks SET value = 'Class', updated_by = NULL WHERE tag = 'service.performance-class.title'").run();
|
||||
db1.prepare("UPDATE content_blocks SET value = 'Performance Class', updated_by = NULL WHERE tag = 'service.performance-class.title'").run();
|
||||
db1.close();
|
||||
|
||||
const db2 = createDb(path);
|
||||
const val = (tag: string) => (db2.prepare('SELECT value FROM content_blocks WHERE tag = ?').get(tag) as { value: string }).value;
|
||||
expect(val('service.performance-class.title')).toBe('Performance Class');
|
||||
expect(val('service.performance-class.title')).toBe('Class');
|
||||
db2.close();
|
||||
|
||||
// Non deve toccare un valore modificato dal pannello.
|
||||
|
||||
Reference in New Issue
Block a user