comparison mod_register_web/mod_register_web.lua @ 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
comparison
equal deleted inserted replaced
1236:59332e0bfbdc 1237:c669cb78b293
115 return nil, "The username field was empty"; 115 return nil, "The username field was empty";
116 end 116 end
117 if usermanager.user_exists(prepped_username, module.host) then 117 if usermanager.user_exists(prepped_username, module.host) then
118 return nil, "Username already taken"; 118 return nil, "Username already taken";
119 end 119 end
120 local registering = { username = username , host = host, allowed = true }
121 module:fire_event("user-registering", registering);
122 if not registering.allowed then
123 return nil, "Registration not allowed";
124 end
120 local ok, err = usermanager.create_user(prepped_username, form.password, module.host); 125 local ok, err = usermanager.create_user(prepped_username, form.password, module.host);
121 if ok then 126 if ok then
122 local extra_data = {}; 127 local extra_data = {};
123 for field in pairs(extra_fields) do 128 for field in pairs(extra_fields) do
124 local field_value = form[field]; 129 local field_value = form[field];