mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Merge pull request #5504 from kowsheek/5499-error-format
Make the 401 error format consistent
This commit is contained in:
commit
fc6b93b9f4
1 changed files with 6 additions and 6 deletions
|
@ -120,13 +120,13 @@ middleware = {
|
||||||
}
|
}
|
||||||
// Generate a JSON response reflecting authentication status
|
// Generate a JSON response reflecting authentication status
|
||||||
if (!user) {
|
if (!user) {
|
||||||
var msg = {
|
var error = {
|
||||||
type: 'error',
|
code: 401,
|
||||||
message: 'Please Sign In',
|
errorType: 'NoPermissionError',
|
||||||
status: 'passive'
|
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
|
// TODO: figure out, why user & authInfo is lost
|
||||||
req.authInfo = info;
|
req.authInfo = info;
|
||||||
|
|
Loading…
Add table
Reference in a new issue