Merge pull request #824 from sharelatex/as-redirect-sl-login-to-v2-login

Allow for redirection of unlinked SL account to /user/login_to_ol_v2
This commit is contained in:
Alasdair Smith 2018-08-21 10:13:52 +01:00 committed by GitHub
commit d99a42e678
2 changed files with 3 additions and 3 deletions

View file

@ -84,7 +84,7 @@ module.exports = AuthenticationController =
doPassportLogin: (req, username, password, done) ->
email = username.toLowerCase()
Modules = require "../../infrastructure/Modules"
Modules.hooks.fire 'preDoPassportLogin', email, (err, infoList) ->
Modules.hooks.fire 'preDoPassportLogin', req, email, (err, infoList) ->
return next(err) if err?
info = infoList.find((i) => i?)
if info?

View file

@ -214,7 +214,7 @@ describe "AuthenticationController", ->
beforeEach ->
@AuthenticationController._recordFailedLogin = sinon.stub()
@AuthenticationController._recordSuccessfulLogin = sinon.stub()
@Modules.hooks.fire = sinon.stub().callsArgWith(2, null, [])
@Modules.hooks.fire = sinon.stub().callsArgWith(3, null, [])
# @AuthenticationController.establishUserSession = sinon.stub().callsArg(2)
@req.body =
email: @email
@ -225,7 +225,7 @@ describe "AuthenticationController", ->
describe "when the preDoPassportLogin hooks produce an info object", ->
beforeEach ->
@Modules.hooks.fire = sinon.stub().callsArgWith(2, null, [null, {redir: '/somewhere'}, null])
@Modules.hooks.fire = sinon.stub().callsArgWith(3, null, [null, {redir: '/somewhere'}, null])
it "should stop early and call done with this info object", (done) ->
@AuthenticationController.doPassportLogin(@req, @req.body.email, @req.body.password, @cb)