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 |