Software /
code /
prosody-modules
Changeset
1320:e670d4cc5027
mod_register_web: Pass request around so IP address can be reported
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 26 Feb 2014 20:15:41 +0100 |
parents | 1319:400a7fdd2049 |
children | 1322:bf6796061037 |
files | mod_register_web/mod_register_web.lua |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 }));