Software /
code /
prosody
Comparison
plugins/mod_register.lua @ 2831:8ee7ec6fc5fc
mod_register: Return a <not-acceptable/> error on empty usernames (thanks Neustradamus).
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 11 Jan 2010 17:52:28 +0500 |
parent | 2260:67b64995ae1e |
child | 2923:b7049746bd29 |
comparison
equal
deleted
inserted
replaced
2830:1df57426263a | 2831:8ee7ec6fc5fc |
---|---|
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 local host = module.host; | 143 local host = module.host; |
144 if not username then | 144 if not username or username == "" then |
145 session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is invalid.")); | 145 session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is invalid.")); |
146 elseif usermanager_user_exists(username, host) then | 146 elseif usermanager_user_exists(username, host) then |
147 session.send(st.error_reply(stanza, "cancel", "conflict", "The requested username already exists.")); | 147 session.send(st.error_reply(stanza, "cancel", "conflict", "The requested username already exists.")); |
148 else | 148 else |
149 if usermanager_create_user(username, password, host) then | 149 if usermanager_create_user(username, password, host) then |