# HG changeset patch # User Kim Alvefur # Date 1393442141 -3600 # Node ID e670d4cc50276cfc1b16f87d0997cc375618496f # Parent 400a7fdd20499d705668d0b4d47c2f149796308f mod_register_web: Pass request around so IP address can be reported diff -r 400a7fdd2049 -r e670d4cc5027 mod_register_web/mod_register_web.lua --- a/mod_register_web/mod_register_web.lua Wed Feb 26 18:36:22 2014 +0100 +++ b/mod_register_web/mod_register_web.lua Wed Feb 26 20:15:41 2014 +0100 @@ -106,7 +106,7 @@ }) end -function register_user(form) +function register_user(form, origin) local prepped_username = nodeprep(form.username); if not prepped_username then return nil, "Username contains forbidden characters"; @@ -137,7 +137,8 @@ module:fire_event("user-registered", { username = prepped_username, host = module.host, - source = module.name + source = module.name, + ip = origin.conn:ip(), }); end return ok, err; @@ -161,7 +162,7 @@ local form = http.formdecode(request.body); verify_captcha(request, form, function (ok, err) if ok then - local register_ok, register_err = register_user(form); + local register_ok, register_err = register_user(form, request); response:send(generate_register_response(event, form, register_ok, register_err)); else response:send(generate_page(event, { register_error = err }));