Introduce endpoint for auth check
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
74a68e992a
commit
c7b1c547b0
@ -35,8 +35,17 @@ async function getUser(req, res, next) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function checkAuth(req,res,next) {
|
||||||
|
if (! req.isAuthed) {
|
||||||
|
res.status(401).body("Not Authorised")
|
||||||
|
} else {
|
||||||
|
res.status(200).body("Authorised Successfully")
|
||||||
|
}
|
||||||
|
next()}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
register,
|
register,
|
||||||
request,
|
request,
|
||||||
getUser
|
getUser,
|
||||||
|
checkAuth
|
||||||
};
|
};
|
@ -4,6 +4,7 @@ const regCtr = require('../controllers/registration.controllers');
|
|||||||
|
|
||||||
// User
|
// User
|
||||||
router.get('/:uuid', regCtr.getUser);
|
router.get('/:uuid', regCtr.getUser);
|
||||||
|
router.get('/checkAuth', regCtr.checkAuth);
|
||||||
// Not Implemented router.delete('/:uuid', regCtr.deleteUser);
|
// Not Implemented router.delete('/:uuid', regCtr.deleteUser);
|
||||||
router.post('/request', regCtr.request);
|
router.post('/request', regCtr.request);
|
||||||
router.post('/register', regCtr.register);
|
router.post('/register', regCtr.register);
|
||||||
|
Loading…
Reference in New Issue
Block a user