Skip to content

Commit

Permalink
Make the 401 error format consistent
Browse files Browse the repository at this point in the history
issue TryGhost#5499

- Update error object being sent from authenticate method
  • Loading branch information
kowsheek committed Jun 30, 2015
1 parent b8415e8 commit 6559f25
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/server/middleware/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6559f25

Please sign in to comment.