Skip to content

Commit

Permalink
Addressed #42, if one can not login via email (local user), and one d…
Browse files Browse the repository at this point in the history
…oes 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.
  • Loading branch information
smhaller committed Jun 26, 2024
1 parent b6eb20b commit 8eaaf5e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ldap-overleaf-sl/sharelatex_diff/router.js.diff
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
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)
> AuthenticationController.addEndpointToLoginWhitelist('/oauth/redirect')
> AuthenticationController.addEndpointToLoginWhitelist('/oauth/callback')
> }
>
1352a1361,1429
1352a1368,1436
> )
>
> webRouter.post('/project/:project_id/track_changes',
Expand Down

0 comments on commit 8eaaf5e

Please sign in to comment.