mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
refactor(app.js, auth.js): Extract all auth method to individual modules
This commit is contained in:
parent
766022378a
commit
69a9f7ca38
12 changed files with 406 additions and 351 deletions
26
lib/web/auth/index.js
Normal file
26
lib/web/auth/index.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict'
|
||||
|
||||
const Router = require('express').Router
|
||||
|
||||
const config = require('../../config')
|
||||
const logger = require('../../logger')
|
||||
|
||||
const authRouter = module.exports = Router()
|
||||
|
||||
if (config.facebook) authRouter.use('/', require('./facebook'))
|
||||
if (config.twitter) authRouter.use('/', require('./twitter'))
|
||||
if (config.github) authRouter.use('/', require('./github'))
|
||||
if (config.gitlab) authRouter.use('/', require('./gitlab'))
|
||||
if (config.dropbox) authRouter.use('/', require('./dropbox'))
|
||||
if (config.google) authRouter.use('/', require('./google'))
|
||||
if (config.ldap) authRouter.use('/', require('./ldap'))
|
||||
if (config.email) authRouter.use('/', require('./email'))
|
||||
|
||||
// logout
|
||||
authRouter.get('/logout', function (req, res) {
|
||||
if (config.debug && req.isAuthenticated()) {
|
||||
logger.debug('user logout: ' + req.user.id)
|
||||
}
|
||||
req.logout()
|
||||
res.redirect(config.serverurl + '/')
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue