mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Don't error if user is not logged in when compiling
This commit is contained in:
@@ -47,8 +47,7 @@ module.exports = AuthenticationController =
|
||||
if req?.session?.user?._id?
|
||||
callback null, req.session.user._id.toString()
|
||||
else
|
||||
e = new Error("user is not on req session")
|
||||
callback e
|
||||
callback null, null
|
||||
|
||||
getLoggedInUser: (req, options = {allow_auth_token: false}, callback = (error, user) ->) ->
|
||||
if req.session?.user?._id?
|
||||
|
||||
+6
-6
@@ -136,21 +136,21 @@ describe "AuthenticationController", ->
|
||||
expect(user_id).to.equal @user_id
|
||||
done()
|
||||
|
||||
it "should return an error if there is no user on the session", (done)->
|
||||
it "should return null if there is no user on the session", (done)->
|
||||
@AuthenticationController.getLoggedInUserId @req, (err, user_id)=>
|
||||
expect(err).to.exist
|
||||
expect(user_id).to.be.null
|
||||
done()
|
||||
|
||||
it "should return an error if there is no session", (done)->
|
||||
it "should return null if there is no session", (done)->
|
||||
@req = {}
|
||||
@AuthenticationController.getLoggedInUserId @req, (err, user_id)=>
|
||||
expect(err).to.exist
|
||||
expect(user_id).to.be.null
|
||||
done()
|
||||
|
||||
it "should return an error if there is no req", (done)->
|
||||
it "should return null if there is no req", (done)->
|
||||
@req = {}
|
||||
@AuthenticationController.getLoggedInUserId @req, (err, user_id)=>
|
||||
expect(err).to.exist
|
||||
expect(user_id).to.be.null
|
||||
done()
|
||||
|
||||
describe "getLoggedInUser", ->
|
||||
|
||||
Reference in New Issue
Block a user