From 8eaaf5e6c0a6ae5d51ecf8bd5f6883a975be9e4a Mon Sep 17 00:00:00 2001 From: "Simon M. Haller-Seeber" Date: Wed, 26 Jun 2024 12:31:44 +0200 Subject: [PATCH] Addressed #42, if one can not login via email (local user), and one does not use ldap but oauth - then there is no login page but a redirect to the oauth provider. Closes issue #42 and pull request #43. --- ldap-overleaf-sl/sharelatex_diff/router.js.diff | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ldap-overleaf-sl/sharelatex_diff/router.js.diff b/ldap-overleaf-sl/sharelatex_diff/router.js.diff index c954059..2a7fdde 100644 --- a/ldap-overleaf-sl/sharelatex_diff/router.js.diff +++ b/ldap-overleaf-sl/sharelatex_diff/router.js.diff @@ -1,6 +1,17 @@ 39a40 > const TrackChangesController = require('./Features/TrackChanges/TrackChangesController') -259a261,267 +218c219,226 +< webRouter.get('/login', UserPagesController.loginPage) +--- +> // If no LDAP Server is in use and no local db login then we can redirect the login +> // and just use OAUTH +> if ( (typeof process.env.LDAP_SERVER === typeof undefined) && (process.env.ALLOW_EMAIL_LOGIN === 'false') && (process.env.OAUTH2_ENABLED === 'true') ) { +> webRouter.get('/login', function (req, res, next) { res.redirect('/oauth/redirect') }) +> } else { +> webRouter.get('/login', UserPagesController.loginPage) +> } +> +259a268,274 > if (process.env.OAUTH2_ENABLED === 'true') { > webRouter.get('/oauth/redirect', AuthenticationController.oauth2Redirect) > webRouter.get('/oauth/callback', AuthenticationController.oauth2Callback) @@ -8,7 +19,7 @@ > AuthenticationController.addEndpointToLoginWhitelist('/oauth/callback') > } > -1352a1361,1429 +1352a1368,1436 > ) > > webRouter.post('/project/:project_id/track_changes',