Customize CSRF token error message

This commit is contained in:
Cohee 2025-01-25 23:20:26 +02:00
parent 2d8da60ffc
commit 44ade6ad64

View File

@ -402,6 +402,10 @@ if (!disableCsrf) {
});
});
// Customize the error message
csrfSyncProtection.invalidCsrfTokenError.message = color.red('Invalid CSRF token. Please refresh the page and try again.');
csrfSyncProtection.invalidCsrfTokenError.stack = undefined;
app.use(csrfSyncProtection.csrfSynchronisedProtection);
} else {
console.warn('\nCSRF protection is disabled. This will make your server vulnerable to CSRF attacks.\n');