Software /
code /
prosody-modules
Comparison
mod_register_json/mod_register_json.lua @ 362:bd0a8c032163
mod_register_json: Typo fix.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Tue, 12 Apr 2011 20:50:43 +0000 |
parent | 361:146496a3be78 |
child | 363:72a5778579c5 |
comparison
equal
deleted
inserted
replaced
361:146496a3be78 | 362:bd0a8c032163 |
---|---|
65 if not usermanager.is_admin(user, req_body["host"]) then | 65 if not usermanager.is_admin(user, req_body["host"]) then |
66 module:log("warn", "%s tried to submit registration data for %s but he's not an admin", user, req_body["host"]); | 66 module:log("warn", "%s tried to submit registration data for %s but he's not an admin", user, req_body["host"]); |
67 return http_response(401, "I obey only to my masters... Have a nice day."); | 67 return http_response(401, "I obey only to my masters... Have a nice day."); |
68 else | 68 else |
69 -- Checks for both Throttling/Whitelist and Blacklist (basically copycatted from prosody's register.lua code) | 69 -- Checks for both Throttling/Whitelist and Blacklist (basically copycatted from prosody's register.lua code) |
70 if blacklist[req_body["ip"]] then then module:log("warn", "Attempt of reg. submission to the JSON servlet from blacklisted address: %s", req_body["ip"]); return http_response(403, "The specified address is blacklisted, sorry sorry."); end | 70 if blacklist[req_body["ip"]] then module:log("warn", "Attempt of reg. submission to the JSON servlet from blacklisted address: %s", req_body["ip"]); return http_response(403, "The specified address is blacklisted, sorry sorry."); end |
71 if throttle_time and not whitelist[req_body["ip"]] then | 71 if throttle_time and not whitelist[req_body["ip"]] then |
72 if not recent_ips[req_body["ip"]] then | 72 if not recent_ips[req_body["ip"]] then |
73 recent_ips[req_body["ip"]] = { time = os_time(), count = 1 }; | 73 recent_ips[req_body["ip"]] = { time = os_time(), count = 1 }; |
74 else | 74 else |
75 local ip = recent_ips[req_body["ip"]]; | 75 local ip = recent_ips[req_body["ip"]]; |