Software / code / prosody
Comparison
plugins/mod_register.lua @ 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 |
| parent | 1523:841d61be198f |
| child | 1858:49eef8e19a71 |
comparison
equal
deleted
inserted
replaced
| 1856:ceeffc081b23 | 1857:ef266aa8e18f |
|---|---|
| 138 end | 138 end |
| 139 end | 139 end |
| 140 -- FIXME shouldn't use table.concat | 140 -- FIXME shouldn't use table.concat |
| 141 username = nodeprep(table.concat(username)); | 141 username = nodeprep(table.concat(username)); |
| 142 password = table.concat(password); | 142 password = table.concat(password); |
| 143 if usermanager_user_exists(username, session.host) then | 143 local host = module.host; |
| 144 if not username then | |
| 145 session.send(st.error_reply(stanza, "modify", "not-acceptable")); | |
| 146 elseif usermanager_user_exists(username, host) then | |
| 144 session.send(st.error_reply(stanza, "cancel", "conflict")); | 147 session.send(st.error_reply(stanza, "cancel", "conflict")); |
| 145 else | 148 else |
| 146 if usermanager_create_user(username, password, session.host) then | 149 if usermanager_create_user(username, password, host) then |
| 147 session.send(st.reply(stanza)); -- user created! | 150 session.send(st.reply(stanza)); -- user created! |
| 148 module:log("info", "User account created: %s@%s", username, session.host); | 151 module:log("info", "User account created: %s@%s", username, host); |
| 149 module:fire_event("user-registered", { | 152 module:fire_event("user-registered", { |
| 150 username = username, host = session.host, source = "mod_register", | 153 username = username, host = host, source = "mod_register", |
| 151 session = session }); | 154 session = session }); |
| 152 else | 155 else |
| 153 -- TODO unable to write file, file may be locked, etc, what's the correct error? | 156 -- TODO unable to write file, file may be locked, etc, what's the correct error? |
| 154 session.send(st.error_reply(stanza, "wait", "internal-server-error")); | 157 session.send(st.error_reply(stanza, "wait", "internal-server-error")); |
| 155 end | 158 end |