From b15e487860ba051b523a8b41fd1ce38cfa114b08 Mon Sep 17 00:00:00 2001 From: Alex Luker Date: Fri, 26 Jul 2024 13:05:04 +0100 Subject: [PATCH] fix issue with success endpoint --- web/oidc-router.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/web/oidc-router.js b/web/oidc-router.js index 4097dc3..b2f16af 100644 --- a/web/oidc-router.js +++ b/web/oidc-router.js @@ -12,12 +12,14 @@ const oidcRouter = Router(); oidcRouter.get('/login', passport.authenticate('login.lescommuns.org')); -oidcRouter.get('/success', (_req, res) => +oidcRouter.get('/success', async (req, res) => { + console.log('User logged in', JSON.stringify(req.user)); + await createOrUpdate(req.user); res .status(200) .set('Content-Type', 'text/html') .send(readFileSync(join(STATIC_PATH, 'success.html'))) -); +}); oidcRouter.get( '/callback', @@ -36,11 +38,4 @@ oidcRouter.get( }) ); -oidcRouter.get('/success', async (req, res) => { - console.log("User has logged in", JSON.stringify(req.user)); - await createOrUpdate(req.user); - - res.json({ success: true, user: req.user }); -}); - export { oidcRouter };