Mercurial > prosody-modules
changeset 879:3a17fc0127b1
mod_vjud: Enforce minimal length of search parameters
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 16 Dec 2012 12:35:43 +0100 |
parents | 6b7a2d1a1879 |
children | 312602605269 |
files | mod_vjud/mod_vjud.lua |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_vjud/mod_vjud.lua Mon Dec 10 22:37:41 2012 +0100 +++ b/mod_vjud/mod_vjud.lua Sun Dec 16 12:35:43 2012 +0100 @@ -85,13 +85,17 @@ else -- type == "set" local query = stanza.tags[1]; local first, last, nick, email = - (query:get_child_text"first" or false), - (query:get_child_text"last" or false), - (query:get_child_text"nick" or false), - (query:get_child_text"email" or false); + s_lower(query:get_child_text"first" or ""), + s_lower(query:get_child_text"last" or ""), + s_lower(query:get_child_text"nick" or ""), + s_lower(query:get_child_text"email" or ""); + first = #first >= 2 and first; + last = #last >= 2 and last; + nick = #nick >= 2 and nick; + email = #email >= 2 and email; if not ( first or last or nick or email ) then - origin.send(st.error_reply(stanza, "modify", "not-acceptable", "All fields were empty")); + origin.send(st.error_reply(stanza, "modify", "not-acceptable", "All fields were empty or too short")); return true; end