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?
|
return next(error) if error?
|
||||||
req.session.justLoggedIn = true
|
req.session.justLoggedIn = true
|
||||||
logger.log email: email, user_id: user._id.toString(), "successful log in"
|
logger.log email: email, user_id: user._id.toString(), "successful log in"
|
||||||
res.send redir: redir
|
res.json redir: redir
|
||||||
else
|
else
|
||||||
AuthenticationController._recordFailedLogin()
|
AuthenticationController._recordFailedLogin()
|
||||||
logger.log email: email, "failed log in"
|
logger.log email: email, "failed log in"
|
||||||
res.send message:
|
res.json message:
|
||||||
text: req.i18n.translate("email_or_password_wrong_try_again"),
|
text: req.i18n.translate("email_or_password_wrong_try_again"),
|
||||||
type: 'error'
|
type: 'error'
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,20 @@ class MockResponse
|
||||||
@body = body if body
|
@body = body if body
|
||||||
@callback() if @callback?
|
@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) ->
|
setHeader: (header, value) ->
|
||||||
@headers[header] = value
|
@headers[header] = value
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue