mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
added some logging
This commit is contained in:
parent
24c50189b6
commit
e1b3f3542c
3 changed files with 7 additions and 2 deletions
|
@ -4,6 +4,7 @@ UserGetter = require("../User/UserGetter")
|
||||||
TokenGenerator = require("./TokenGenerator")
|
TokenGenerator = require("./TokenGenerator")
|
||||||
EmailHandler = require("../Email/EmailHandler")
|
EmailHandler = require("../Email/EmailHandler")
|
||||||
AuthenticationManager = require("../Authentication/AuthenticationManager")
|
AuthenticationManager = require("../Authentication/AuthenticationManager")
|
||||||
|
logger = require("logger-sharelatex")
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ module.exports =
|
||||||
UserGetter.getUser email:email, (err, user)->
|
UserGetter.getUser email:email, (err, user)->
|
||||||
if err then return callback(err)
|
if err then return callback(err)
|
||||||
if !user?
|
if !user?
|
||||||
|
logger.err email:email, "user could not be found for password reset"
|
||||||
return callback("no user found")
|
return callback("no user found")
|
||||||
TokenGenerator.getNewToken user._id, (err, token)->
|
TokenGenerator.getNewToken user._id, (err, token)->
|
||||||
if err then return callback(err)
|
if err then return callback(err)
|
||||||
|
@ -23,5 +25,6 @@ module.exports =
|
||||||
TokenGenerator.getUserIdFromToken token, (err, user_id)->
|
TokenGenerator.getUserIdFromToken token, (err, user_id)->
|
||||||
if err then return callback(err)
|
if err then return callback(err)
|
||||||
if !user_id?
|
if !user_id?
|
||||||
|
logger.err email:email, "token for password reset did not find user_id"
|
||||||
return callback("no user found")
|
return callback("no user found")
|
||||||
AuthenticationManager.setUserPassword user_id, password, callback
|
AuthenticationManager.setUserPassword user_id, password, callback
|
|
@ -3,6 +3,7 @@ redis = require('redis')
|
||||||
rclient = redis.createClient(Settings.redis.web.port, Settings.redis.web.host)
|
rclient = redis.createClient(Settings.redis.web.port, Settings.redis.web.host)
|
||||||
rclient.auth(Settings.redis.web.password)
|
rclient.auth(Settings.redis.web.password)
|
||||||
uuid = require("node-uuid")
|
uuid = require("node-uuid")
|
||||||
|
logger = require("logger-sharelatex")
|
||||||
|
|
||||||
ONE_HOUR_IN_S = 60 * 60
|
ONE_HOUR_IN_S = 60 * 60
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ buildKey = (token)-> return "password_token:#{token}"
|
||||||
module.exports =
|
module.exports =
|
||||||
|
|
||||||
getNewToken: (user_id, callback)->
|
getNewToken: (user_id, callback)->
|
||||||
|
logger.log user_id:user_id, "generating token for password reset"
|
||||||
token = uuid.v4()
|
token = uuid.v4()
|
||||||
multi = rclient.multi()
|
multi = rclient.multi()
|
||||||
multi.set buildKey(token), user_id
|
multi.set buildKey(token), user_id
|
||||||
|
@ -19,6 +21,7 @@ module.exports =
|
||||||
callback(err, token)
|
callback(err, token)
|
||||||
|
|
||||||
getUserIdFromToken: (token, callback)->
|
getUserIdFromToken: (token, callback)->
|
||||||
|
logger.log token:token, "getting user id from password token"
|
||||||
multi = rclient.multi()
|
multi = rclient.multi()
|
||||||
multi.get buildKey(token)
|
multi.get buildKey(token)
|
||||||
multi.del buildKey(token)
|
multi.del buildKey(token)
|
||||||
|
|
|
@ -10,9 +10,8 @@ block content
|
||||||
form.validate#setPasswordReset(method='post')
|
form.validate#setPasswordReset(method='post')
|
||||||
input(type="hidden", name="_csrf", value=csrfToken)
|
input(type="hidden", name="_csrf", value=csrfToken)
|
||||||
.clearfix
|
.clearfix
|
||||||
label(for='xlInput') Password
|
|
||||||
.input
|
.input
|
||||||
input.span4.email.required(type='password', name='password', placeholder='password')
|
input.span4.email.required(type='password', name='password', placeholder='new password')
|
||||||
.input
|
.input
|
||||||
input(type="hidden", name="passwordResetToken", value=passwordResetToken)
|
input(type="hidden", name="passwordResetToken", value=passwordResetToken)
|
||||||
.actions
|
.actions
|
||||||
|
|
Loading…
Reference in a new issue