0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Make the 401 error format consistent

issue #5499

- Update error object being sent from authenticate method
This commit is contained in:
Kowsheek Mahmood 2015-06-30 12:38:47 -04:00
parent b8415e8b90
commit 6559f25ebe

View file

@ -120,13 +120,13 @@ middleware = {
}
// Generate a JSON response reflecting authentication status
if (!user) {
var msg = {
type: 'error',
message: 'Please Sign In',
status: 'passive'
var error = {
code: 401,
errorType: 'NoPermissionError',
message: 'Please Sign In'
};
res.status(401);
return res.send(msg);
return apiErrorHandlers.errorHandler(error, req, res, next);
}
// TODO: figure out, why user & authInfo is lost
req.authInfo = info;