net.server_select: Add and improve some comments.
[prosody.git] / plugins / mod_register.lua
index dfc8c49b9f84fbafd913374693f5b47c2670fbd3..e941a128967a1697c785278bdff66e7298e25a4d 100644 (file)
@@ -7,7 +7,6 @@
 --
 
 
-local hosts = _G.hosts;
 local st = require "util.stanza";
 local datamanager = require "util.datamanager";
 local dataform_new = require "util.dataforms".new;
@@ -223,6 +222,12 @@ module:hook("stanza/iq/jabber:iq:register:query", function(event)
                                        local host = module.host;
                                        if not username or username == "" then
                                                session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is invalid."));
+                                               return true;
+                                       end
+                                       local user = { username = username , host = host, allowed = true }
+                                       module:fire_event("user-registering", user);
+                                       if not user.allowed then
+                                               session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is forbidden."));
                                        elseif usermanager_user_exists(username, host) then
                                                session.send(st.error_reply(stanza, "cancel", "conflict", "The requested username already exists."));
                                        else