comparison mod_register_web/mod_register_web.lua @ 1238:752285859607

mod_register_web: Use correct variables
author Kim Alvefur <zash@zash.se>
date Sat, 30 Nov 2013 23:46:54 +0100
parents c669cb78b293
children cc5cbeeb9fc7
comparison
equal deleted inserted replaced
1237:c669cb78b293 1238:752285859607
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 } 120 local registering = { username = prepped_username , host = module.host, allowed = true }
121 module:fire_event("user-registering", registering); 121 module:fire_event("user-registering", registering);
122 if not registering.allowed then 122 if not registering.allowed then
123 return nil, "Registration not allowed"; 123 return nil, "Registration not allowed";
124 end 124 end
125 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);
129 local field_value = form[field]; 129 local field_value = form[field];
130 if field_value and #field_value > 0 then 130 if field_value and #field_value > 0 then
131 extra_data[field] = field_value; 131 extra_data[field] = field_value;
132 end 132 end
133 end 133 end
134 if next(first) ~= nil then 134 if next(extra_data) ~= nil then
135 datamanager.store(prepped_username, module.host, "account_details", extra_data); 135 datamanager.store(prepped_username, module.host, "account_details", extra_data);
136 end 136 end
137 module:fire_event("user-registered", { 137 module:fire_event("user-registered", {
138 username = prepped_username, 138 username = prepped_username,
139 host = module.host, 139 host = module.host,