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")
|
||||
EmailHandler = require("../Email/EmailHandler")
|
||||
AuthenticationManager = require("../Authentication/AuthenticationManager")
|
||||
logger = require("logger-sharelatex")
|
||||
|
||||
module.exports =
|
||||
|
||||
|
@ -11,6 +12,7 @@ module.exports =
|
|||
UserGetter.getUser email:email, (err, user)->
|
||||
if err then return callback(err)
|
||||
if !user?
|
||||
logger.err email:email, "user could not be found for password reset"
|
||||
return callback("no user found")
|
||||
TokenGenerator.getNewToken user._id, (err, token)->
|
||||
if err then return callback(err)
|
||||
|
@ -23,5 +25,6 @@ module.exports =
|
|||
TokenGenerator.getUserIdFromToken token, (err, user_id)->
|
||||
if err then return callback(err)
|
||||
if !user_id?
|
||||
logger.err email:email, "token for password reset did not find user_id"
|
||||
return callback("no user found")
|
||||
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.auth(Settings.redis.web.password)
|
||||
uuid = require("node-uuid")
|
||||
logger = require("logger-sharelatex")
|
||||
|
||||
ONE_HOUR_IN_S = 60 * 60
|
||||
|
||||
|
@ -11,6 +12,7 @@ buildKey = (token)-> return "password_token:#{token}"
|
|||
module.exports =
|
||||
|
||||
getNewToken: (user_id, callback)->
|
||||
logger.log user_id:user_id, "generating token for password reset"
|
||||
token = uuid.v4()
|
||||
multi = rclient.multi()
|
||||
multi.set buildKey(token), user_id
|
||||
|
@ -19,6 +21,7 @@ module.exports =
|
|||
callback(err, token)
|
||||
|
||||
getUserIdFromToken: (token, callback)->
|
||||
logger.log token:token, "getting user id from password token"
|
||||
multi = rclient.multi()
|
||||
multi.get buildKey(token)
|
||||
multi.del buildKey(token)
|
||||
|
|
|
@ -10,9 +10,8 @@ block content
|
|||
form.validate#setPasswordReset(method='post')
|
||||
input(type="hidden", name="_csrf", value=csrfToken)
|
||||
.clearfix
|
||||
label(for='xlInput') Password
|
||||
.input
|
||||
input.span4.email.required(type='password', name='password', placeholder='password')
|
||||
input.span4.email.required(type='password', name='password', placeholder='new password')
|
||||
.input
|
||||
input(type="hidden", name="passwordResetToken", value=passwordResetToken)
|
||||
.actions
|
||||
|
|
Loading…
Reference in a new issue