Software /
code /
prosody
Changeset
1857:ef266aa8e18f
mod_register: Fixed: No error was returned if username failed nodeprep.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 02 Oct 2009 16:50:30 +0500 |
parents | 1856:ceeffc081b23 |
children | 1858:49eef8e19a71 |
files | plugins/mod_register.lua |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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?