next -> callback

This commit is contained in:
James Allen 2016-02-16 11:12:07 +00:00
parent 87ef2cc563
commit b3a2d44937

View file

@ -70,14 +70,14 @@ module.exports = UserRegistrationHandler =
password: crypto.randomBytes(32).toString("hex")
}, (err, user)->
if err? and err?.message != "EmailAlreadyRegistered"
return next(err)
return callback(err)
if err?.message == "EmailAlreadyRegistered"
logger.log {email}, "user already exists, resending welcome email"
ONE_WEEK = 7 * 24 * 60 * 60 # seconds
OneTimeTokenHandler.getNewToken user._id, { expiresIn: ONE_WEEK }, (err, token)->
return next(err) if err?
return callback(err) if err?
setNewPasswordUrl = "#{settings.siteUrl}/user/activate?token=#{token}&user_id=#{user._id}"