Added CSRF protection to all API calls. /api/account AJAX calls updated.
This commit is contained in:
parent
7e0c8e72c5
commit
106b0fcddb
11 changed files with 149 additions and 14 deletions
|
|
@ -38,4 +38,17 @@ module.exports.socketCriticalExceptionHandler = function(socket, err){
|
|||
|
||||
module.exports.consoleWarn = function(string){
|
||||
console.warn('\x1b[31m\x1b[4m%s\x1b[0m',string);
|
||||
}
|
||||
|
||||
//Basic error-handling middleware to ensure we're not dumping stack traces
|
||||
module.exports.errorMiddleware = function(err, req, res, next){
|
||||
//Set generic error
|
||||
var reason = "Server Error";
|
||||
|
||||
//If it's un-authorized
|
||||
if(err.status == 403){
|
||||
reason = "Unauthorized"
|
||||
}
|
||||
|
||||
module.exports.errorHandler(res, err.message, reason, err.status);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue