Software /
code /
prosody
Diff
plugins/mod_register.lua @ 5165:39bb9344f194
mod_register: Fire event to allow blocking user registration
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Mon, 01 Oct 2012 21:07:20 +0200 |
parent | 5098:fca8b5946f6f |
child | 5371:706206e191e8 |
line wrap: on
line diff
--- a/plugins/mod_register.lua Sat Sep 29 17:07:08 2012 +0100 +++ b/plugins/mod_register.lua Mon Oct 01 21:07:20 2012 +0200 @@ -223,6 +223,12 @@ 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