mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Remove getLoggedInUser
This commit is contained in:
parent
eca1dfa482
commit
bb71433727
2 changed files with 0 additions and 31 deletions
|
@ -15,9 +15,6 @@ passport = require 'passport'
|
|||
|
||||
module.exports = AuthenticationController =
|
||||
|
||||
# login: (req, res, next = (error) ->) ->
|
||||
# AuthenticationController.doLogin req.body, req, res, next
|
||||
|
||||
serializeUser: (user, callback) ->
|
||||
lightUser =
|
||||
_id: user._id
|
||||
|
@ -47,7 +44,6 @@ module.exports = AuthenticationController =
|
|||
res.json message: info
|
||||
)(req, res, next)
|
||||
|
||||
|
||||
doPassportLogin: (req, username, password, done) ->
|
||||
email = username.toLowerCase()
|
||||
redir = Url.parse(req?.body?.redir or "/project").path
|
||||
|
@ -96,14 +92,6 @@ module.exports = AuthenticationController =
|
|||
else
|
||||
return null
|
||||
|
||||
# TODO: perhaps should produce an error if the current user is not present
|
||||
getLoggedInUser: (req, callback = (error, user) ->) ->
|
||||
user_id = AuthenticationController.getLoggedInUserId(req)
|
||||
if !user_id?
|
||||
return callback(null, null)
|
||||
# omit sensitive information
|
||||
UserGetter.getUser user_id, {hashedPassword: false, refProviders: false}, callback
|
||||
|
||||
requireLogin: () ->
|
||||
doRequest = (req, res, next = (error) ->) ->
|
||||
if !AuthenticationController.isUserLoggedIn(req)
|
||||
|
@ -141,7 +129,6 @@ module.exports = AuthenticationController =
|
|||
else
|
||||
AuthenticationController._redirectToLoginPage(req, res)
|
||||
|
||||
|
||||
_redirectToLoginPage: (req, res) ->
|
||||
logger.log url: req.url, "user not logged in so redirecting to login page"
|
||||
req.query.redir = req.path
|
||||
|
|
|
@ -256,24 +256,6 @@ describe "AuthenticationController", ->
|
|||
result = @AuthenticationController.getLoggedInUserId @req
|
||||
expect(result).to.equal null
|
||||
|
||||
describe "getLoggedInUser", ->
|
||||
beforeEach ->
|
||||
@UserGetter.getUser = sinon.stub().callsArgWith(2, null, @user)
|
||||
|
||||
describe "with an established session", ->
|
||||
beforeEach ->
|
||||
@req.session =
|
||||
user: @user
|
||||
@AuthenticationController.getLoggedInUser(@req, @callback)
|
||||
|
||||
it "should look up the user in the database", ->
|
||||
@UserGetter.getUser
|
||||
.calledWith(@user._id)
|
||||
.should.equal true
|
||||
|
||||
it "should return the user", ->
|
||||
@callback.calledWith(null, @user).should.equal true
|
||||
|
||||
describe "requireLogin", ->
|
||||
beforeEach ->
|
||||
@user =
|
||||
|
|
Loading…
Reference in a new issue