mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
WIP: enable sudo-mode for v2
This commit is contained in:
parent
6b8eb0ac23
commit
254d74899b
3 changed files with 7 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue