Customize CSRF token error message
| @@ -402,6 +402,10 @@ if (!disableCsrf) { | ||
| 402 | 402 | }); |
| 403 | 403 | }); |
| 404 | 404 | |
| 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 | 409 | app.use(csrfSyncProtection.csrfSynchronisedProtection); |
| 406 | 410 | } else { |
| 407 | 411 | console.warn('\nCSRF protection is disabled. This will make your server vulnerable to CSRF attacks.\n'); |