WIP: enable sudo-mode for v2

This commit is contained in:
Shane Kilkelly 2018-09-13 15:18:00 +01:00
parent 6b8eb0ac23
commit 254d74899b
3 changed files with 7 additions and 2 deletions

View file

@ -4,12 +4,13 @@ AuthenticationController = require '../Authentication/AuthenticationController'
AuthenticationManager = require '../Authentication/AuthenticationManager'
ObjectId = require('../../infrastructure/Mongoose').mongo.ObjectId
UserGetter = require '../User/UserGetter'
Settings = require 'settings-sharelatex'
module.exports = SudoModeController =
sudoModePrompt: (req, res, next) ->
if req.externalAuthenticationSystemUsed()
if req.externalAuthenticationSystemUsed() and !Settings.overleaf?
logger.log {userId}, "[SudoMode] using external auth, redirecting"
return res.redirect('/project')
userId = AuthenticationController.getLoggedInUserId(req)

View file

@ -1,12 +1,13 @@
logger = require 'logger-sharelatex'
SudoModeHandler = require './SudoModeHandler'
AuthenticationController = require '../Authentication/AuthenticationController'
Settings = require 'settings-sharelatex'
module.exports = SudoModeMiddlewear =
protectPage: (req, res, next) ->
if req.externalAuthenticationSystemUsed()
if req.externalAuthenticationSystemUsed() and !Settings.overleaf?
logger.log {userId}, "[SudoMode] using external auth, skipping sudo-mode check"
return next()
userId = AuthenticationController.getLoggedInUserId(req)

View file

@ -43,3 +43,6 @@ block content
p.text-centered
small
| #{translate('confirm_password_footer')}
p.text-centered
small #[a(href='/user/password/reset' target="_blank") Set or reset password]