# HG changeset patch # User Waqas Hussain # Date 1254484230 -18000 # Node ID ef266aa8e18f6d72aca04671db0ff9fd8cd9e1c4 # Parent ceeffc081b23979f347435febd5e1334b3eb0f5b mod_register: Fixed: No error was returned if username failed nodeprep. diff -r ceeffc081b23 -r ef266aa8e18f plugins/mod_register.lua --- a/plugins/mod_register.lua Fri Oct 02 16:46:39 2009 +0500 +++ b/plugins/mod_register.lua Fri Oct 02 16:50:30 2009 +0500 @@ -140,14 +140,17 @@ -- FIXME shouldn't use table.concat username = nodeprep(table.concat(username)); password = table.concat(password); - if usermanager_user_exists(username, session.host) then + local host = module.host; + if not username then + session.send(st.error_reply(stanza, "modify", "not-acceptable")); + elseif usermanager_user_exists(username, host) then session.send(st.error_reply(stanza, "cancel", "conflict")); else - if usermanager_create_user(username, password, session.host) then + if usermanager_create_user(username, password, host) then session.send(st.reply(stanza)); -- user created! - module:log("info", "User account created: %s@%s", username, session.host); + module:log("info", "User account created: %s@%s", username, host); module:fire_event("user-registered", { - username = username, host = session.host, source = "mod_register", + username = username, host = host, source = "mod_register", session = session }); else -- TODO unable to write file, file may be locked, etc, what's the correct error?