mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
move login success to .json as it sends json over
This commit is contained in:
parent
d5d5ba9066
commit
690b195f1a
2 changed files with 16 additions and 2 deletions
|
@ -35,11 +35,11 @@ module.exports = AuthenticationController =
|
|||
return next(error) if error?
|
||||
req.session.justLoggedIn = true
|
||||
logger.log email: email, user_id: user._id.toString(), "successful log in"
|
||||
res.send redir: redir
|
||||
res.json redir: redir
|
||||
else
|
||||
AuthenticationController._recordFailedLogin()
|
||||
logger.log email: email, "failed log in"
|
||||
res.send message:
|
||||
res.json message:
|
||||
text: req.i18n.translate("email_or_password_wrong_try_again"),
|
||||
type: 'error'
|
||||
|
||||
|
|
|
@ -48,6 +48,20 @@ class MockResponse
|
|||
@success = false
|
||||
@body = body if body
|
||||
@callback() if @callback?
|
||||
|
||||
json: (status, body) ->
|
||||
if arguments.length < 2
|
||||
if typeof status != "number"
|
||||
body = status
|
||||
status = 200
|
||||
@statusCode = status
|
||||
@returned = true
|
||||
if 200 <= status < 300
|
||||
@success = true
|
||||
else
|
||||
@success = false
|
||||
@body = body if body
|
||||
@callback() if @callback?
|
||||
|
||||
setHeader: (header, value) ->
|
||||
@headers[header] = value
|
||||
|
|
Loading…
Reference in a new issue