mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
WIP: enable sudo-mode for v2
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user