Changeset

1232:12f59489ef6e

mod_register_web: Fire user-registered event
author Kim Alvefur <zash@zash.se>
date Sat, 30 Nov 2013 20:29:49 +0100
parents 1231:502ce9672eae
children 1233:f7b1992e4ff6
files mod_register_web/mod_register_web.lua
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_register_web/mod_register_web.lua	Sat Nov 30 20:29:21 2013 +0100
+++ b/mod_register_web/mod_register_web.lua	Sat Nov 30 20:29:49 2013 +0100
@@ -108,7 +108,15 @@
 	if usermanager.user_exists(prepped_username, module.host) then
 		return nil, "Username already taken";
 	end
-	return usermanager.create_user(prepped_username, form.password, module.host);
+	local ok, err usermanager.create_user(prepped_username, form.password, module.host);
+	if ok then
+		module:fire_event("user-registered", {
+			username = prepped_username,
+			host = module.host,
+			source = module.name
+		});
+	end
+	return ok, err;
 end
 
 function generate_success(event, form)