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) {
402 });402 });
403 });403 });
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
405 app.use(csrfSyncProtection.csrfSynchronisedProtection);409 app.use(csrfSyncProtection.csrfSynchronisedProtection);
406} else {410} else {
407 console.warn('\nCSRF protection is disabled. This will make your server vulnerable to CSRF attacks.\n');411 console.warn('\nCSRF protection is disabled. This will make your server vulnerable to CSRF attacks.\n');