Customize CSRF token error message

44ade6ad640c3bfb4f4216e6f2341ef362ff23ae

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -0Ignore whitespace
server.js+4 -0
@@ -402,6 +402,10 @@ if (!disableCsrf) {
402402 });
403403 });
404404
405+ // Customize the error message
406+ csrfSyncProtection.invalidCsrfTokenError.message = color.red('Invalid CSRF token. Please refresh the page and try again.');
407+ csrfSyncProtection.invalidCsrfTokenError.stack = undefined;
408+
405409 app.use(csrfSyncProtection.csrfSynchronisedProtection);
406410} else {
407411 console.warn('\nCSRF protection is disabled. This will make your server vulnerable to CSRF attacks.\n');