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.

This commit is contained in:
Simon M. Haller-Seeber
2024-06-26 12:31:44 +02:00
parent b6eb20b71d
commit 8eaaf5e6c0

View File

@@ -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',