mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-04-24 15:37:12 -05:00
fixed broken /check endpoint
This commit is contained in:
parent
c73bba5a64
commit
1205b62d24
|
|
@ -13,8 +13,7 @@ function adminAuthenticationRequired(req, res, next) {
|
|||
if (req.isAuthenticated() && req.user.role && req.user.role === 'admin') {
|
||||
return next();
|
||||
} else {
|
||||
console.log('sending auth error');
|
||||
common.sendApiAuthError(req, res);
|
||||
common.sendApiAuthError(res);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,10 +101,9 @@ router.post('/admin/api/v1/register', adminUserMiddleware.adminAuthenticationReq
|
|||
* }
|
||||
*/
|
||||
router.get('/admin/api/v1/check', adminUserMiddleware.authenticationOptional, (req, res) => {
|
||||
if (!req.user) req.user = {};
|
||||
common.sendApiReturn(res, {
|
||||
IsAuthed: req.isAuthenticated(),
|
||||
role: req.user.role ? req.user.role : undefined
|
||||
isAuthed: req.user ? true : false,
|
||||
role: req.user ? (req.user.role ? req.user.role : undefined) : undefined
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user