diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-10-02 16:50:30 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-10-02 16:50:30 +0500 |
commit | de9cac43cccfd45ad867c7f08013860d0a0ea217 (patch) | |
tree | 46fde0351c10f7f83f6477c21cf27b5fcd9ab08f | |
parent | 724ffca435bed3c9bbd6dbfa048c922a2b48a05e (diff) | |
download | prosody-de9cac43cccfd45ad867c7f08013860d0a0ea217.tar.gz prosody-de9cac43cccfd45ad867c7f08013860d0a0ea217.zip |
mod_register: Fixed: No error was returned if username failed nodeprep.
-rw-r--r-- | plugins/mod_register.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index 383ab811..d29a74af 100644 --- a/plugins/mod_register.lua +++ b/plugins/mod_register.lua @@ -140,14 +140,17 @@ module:add_iq_handler("c2s_unauthed", "jabber:iq:register", function (session, s -- 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? |