changeset 1237:c669cb78b293

mod_register_web: Fire user-registering event like mod_register
author Kim Alvefur <zash@zash.se>
date Sat, 30 Nov 2013 23:37:39 +0100
parents 59332e0bfbdc
children 752285859607
files mod_register_web/mod_register_web.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_register_web/mod_register_web.lua	Sat Nov 30 23:36:41 2013 +0100
+++ b/mod_register_web/mod_register_web.lua	Sat Nov 30 23:37:39 2013 +0100
@@ -117,6 +117,11 @@
 	if usermanager.user_exists(prepped_username, module.host) then
 		return nil, "Username already taken";
 	end
+	local registering = { username = username , host = host, allowed = true }
+	module:fire_event("user-registering", registering);
+	if not registering.allowed then
+		return nil, "Registration not allowed";
+	end
 	local ok, err = usermanager.create_user(prepped_username, form.password, module.host);
 	if ok then
 		local extra_data = {};