changeset 1322:bf6796061037

Merge
author Kim Alvefur <zash@zash.se>
date Wed, 26 Feb 2014 20:17:13 +0100
parents e670d4cc5027 (diff) 3fd6579d60cc (current diff)
children c84ff82658cb
files
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_register_web/mod_register_web.lua	Wed Feb 26 12:38:57 2014 -0500
+++ b/mod_register_web/mod_register_web.lua	Wed Feb 26 20:17:13 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 }));