Comparison

plugins/mod_register_ibr.lua @ 10286:23b26a414d71

mod_register_ibr, mod_register_limits: Add support for custom error type and defined-condition.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 29 Sep 2019 15:26:18 +0200
parent 10281:f90abf142d53
child 10287:a1c0395a59ae
comparison
equal deleted inserted replaced
10285:bcf61e22f841 10286:23b26a414d71
166 166
167 local user = { username = username, password = password, host = host, additional = data, ip = session.ip, session = session, allowed = true } 167 local user = { username = username, password = password, host = host, additional = data, ip = session.ip, session = session, allowed = true }
168 module:fire_event("user-registering", user); 168 module:fire_event("user-registering", user);
169 if not user.allowed then 169 if not user.allowed then
170 log("debug", "Registration disallowed by module: %s", user.reason or "no reason given"); 170 log("debug", "Registration disallowed by module: %s", user.reason or "no reason given");
171 session.send(st.error_reply(stanza, "modify", "not-acceptable", user.reason)); 171 session.send(st.error_reply(stanza, user.error_type or "modify", user.error_condition or "not-acceptable", user.reason));
172 return true; 172 return true;
173 end 173 end
174 174
175 if usermanager_user_exists(username, host) then 175 if usermanager_user_exists(username, host) then
176 log("debug", "Attempt to register with existing username"); 176 log("debug", "Attempt to register with existing username");