Mercurial > prosody-modules
comparison mod_register_json/mod_register_json.lua @ 919:7d72fb45b1e4
mod_register_json: correct invalid characters into usernames' log message.
| author | Marco Cirillo <maranda@lightwitch.org> |
|---|---|
| date | Mon, 04 Mar 2013 14:27:04 +0100 |
| parents | 9c5573b389c0 |
| children |
comparison
equal
deleted
inserted
replaced
| 918:dec71c31fb78 | 919:7d72fb45b1e4 |
|---|---|
| 83 | 83 |
| 84 -- We first check if the supplied username for registration is already there. | 84 -- We first check if the supplied username for registration is already there. |
| 85 -- And nodeprep the username | 85 -- And nodeprep the username |
| 86 local username = nodeprep(req_body["username"]) | 86 local username = nodeprep(req_body["username"]) |
| 87 if not username then | 87 if not username then |
| 88 module:log("debug", "%s supplied an username containing invalid characters: %s", user, username) | 88 module:log("debug", "An username containing invalid characters was supplied: %s", user) |
| 89 return http_response(event, 406, "Supplied username contains invalid characters, see RFC 6122.") | 89 return http_response(event, 406, "Supplied username contains invalid characters, see RFC 6122.") |
| 90 else | 90 else |
| 91 if not usermanager.user_exists(username, req_body["host"]) then | 91 if not usermanager.user_exists(username, req_body["host"]) then |
| 92 -- if username fails to register successive requests shouldn't be throttled until one is successful. | 92 -- if username fails to register successive requests shouldn't be throttled until one is successful. |
| 93 if throttle_time and not whitelist:contains(req_body["ip"]) then | 93 if throttle_time and not whitelist:contains(req_body["ip"]) then |
