changed return code
This commit is contained in:
parent
90969cfe4c
commit
cabdff7177
@ -57,7 +57,7 @@ export function checkPermissions(): RequestHandler {
|
||||
}
|
||||
|
||||
if (!req.session.user) {
|
||||
next({ status: 403, messsage: 'Forbidden' });
|
||||
next({ status: 401, messsage: 'Unauthorized' });
|
||||
return;
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ export function checkPermissions(): RequestHandler {
|
||||
req.session.user.role !== UserRoles.ADMIN) ||
|
||||
(!canAccess(req) && req.session.user.role !== UserRoles.ADMIN)
|
||||
) {
|
||||
next({ status: 403, messsage: 'Forbidden' });
|
||||
next({ status: 401, messsage: 'Unauthorized' });
|
||||
return;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ export function checkPermissions(): RequestHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
next({ status: 403, messsage: 'Forbidden' });
|
||||
next({ status: 401, messsage: 'Unauthorized' });
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ function LoginHandler(services: Services): RequestHandler {
|
||||
user ? (req.session.user = user) : (req.session.user = null);
|
||||
user
|
||||
? res.status(200).send(user)
|
||||
: next({ status: 404, message: 'wrong user or password' });
|
||||
: next({ status: 401, message: 'wrong username or password' });
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user