mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
wip: acceptance tests working
This commit is contained in:
parent
b0a10c948c
commit
3a5b3a8e8d
2 changed files with 2 additions and 13 deletions
|
@ -18,7 +18,6 @@ module.exports = AuthenticationController =
|
||||||
# AuthenticationController.doLogin req.body, req, res, next
|
# AuthenticationController.doLogin req.body, req, res, next
|
||||||
|
|
||||||
serializeUser: (user, callback) ->
|
serializeUser: (user, callback) ->
|
||||||
console.log ">> serialize", user._id
|
|
||||||
lightUser =
|
lightUser =
|
||||||
_id: user._id
|
_id: user._id
|
||||||
first_name: user.first_name
|
first_name: user.first_name
|
||||||
|
@ -31,14 +30,11 @@ module.exports = AuthenticationController =
|
||||||
callback(null, lightUser)
|
callback(null, lightUser)
|
||||||
|
|
||||||
deserializeUser: (user, cb) ->
|
deserializeUser: (user, cb) ->
|
||||||
console.log ">> de-serialize", user._id
|
|
||||||
cb(null, user)
|
cb(null, user)
|
||||||
|
|
||||||
doPassportLogin: (req, username, password, done) ->
|
doPassportLogin: (req, username, password, done) ->
|
||||||
console.log(">>", username)
|
|
||||||
email = username.toLowerCase()
|
email = username.toLowerCase()
|
||||||
redir = Url.parse(req?.body?.redir or "/project").path
|
redir = Url.parse(req?.body?.redir or "/project").path
|
||||||
console.log ">> doing passport login", username, password, redir
|
|
||||||
LoginRateLimiter.processLoginRequest email, (err, isAllowed)->
|
LoginRateLimiter.processLoginRequest email, (err, isAllowed)->
|
||||||
return done(err) if err?
|
return done(err) if err?
|
||||||
if !isAllowed
|
if !isAllowed
|
||||||
|
@ -58,7 +54,6 @@ module.exports = AuthenticationController =
|
||||||
# capture the request ip for use when creating the session
|
# capture the request ip for use when creating the session
|
||||||
user._login_req_ip = req.ip
|
user._login_req_ip = req.ip
|
||||||
req._redir = redir
|
req._redir = redir
|
||||||
console.log ">> done, returning user"
|
|
||||||
return done(null, user)
|
return done(null, user)
|
||||||
else
|
else
|
||||||
AuthenticationController._recordFailedLogin()
|
AuthenticationController._recordFailedLogin()
|
||||||
|
|
|
@ -8,14 +8,8 @@ rclient = redis.createClient(Settings.redis.web)
|
||||||
module.exports =
|
module.exports =
|
||||||
|
|
||||||
getUserSessions: (user, callback=(err, sessionsSet)->) ->
|
getUserSessions: (user, callback=(err, sessionsSet)->) ->
|
||||||
console.log ">> user, get sessions", user._id
|
rclient.smembers "UserSessions:#{user._id}", (err, result) ->
|
||||||
setTimeout(
|
return callback(err, result)
|
||||||
()->
|
|
||||||
rclient.smembers "UserSessions:#{user._id}", (err, result) ->
|
|
||||||
console.log ">>", result
|
|
||||||
return callback(err, result)
|
|
||||||
, 1000
|
|
||||||
)
|
|
||||||
|
|
||||||
clearUserSessions: (user, callback=(err)->) ->
|
clearUserSessions: (user, callback=(err)->) ->
|
||||||
sessionSetKey = "UserSessions:#{user._id}"
|
sessionSetKey = "UserSessions:#{user._id}"
|
||||||
|
|
Loading…
Reference in a new issue