Comparison

plugins/mod_register.lua @ 5166:72cdc2d4e15e

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Mon, 01 Oct 2012 20:15:39 +0100
parent 5165:39bb9344f194
child 5371:706206e191e8
comparison
equal deleted inserted replaced
5164:12f5a3438090 5166:72cdc2d4e15e
221 local username, password = nodeprep(data.username), data.password; 221 local username, password = nodeprep(data.username), data.password;
222 data.username, data.password = nil, nil; 222 data.username, data.password = nil, nil;
223 local host = module.host; 223 local host = module.host;
224 if not username or username == "" then 224 if not username or username == "" then
225 session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is invalid.")); 225 session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is invalid."));
226 return true;
227 end
228 local user = { username = username , host = host, allowed = true }
229 module:fire_event("user-registering", user);
230 if not user.allowed then
231 session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is forbidden."));
226 elseif usermanager_user_exists(username, host) then 232 elseif usermanager_user_exists(username, host) then
227 session.send(st.error_reply(stanza, "cancel", "conflict", "The requested username already exists.")); 233 session.send(st.error_reply(stanza, "cancel", "conflict", "The requested username already exists."));
228 else 234 else
229 -- TODO unable to write file, file may be locked, etc, what's the correct error? 235 -- TODO unable to write file, file may be locked, etc, what's the correct error?
230 local error_reply = st.error_reply(stanza, "wait", "internal-server-error", "Failed to write data to disk."); 236 local error_reply = st.error_reply(stanza, "wait", "internal-server-error", "Failed to write data to disk.");