Mercurial > prosody-modules
comparison mod_register_json/mod_register_json.lua @ 916:9c5573b389c0
mod_register_json: remove unrequired instruction (since it's done above already).
| author | Marco Cirillo <maranda@lightwitch.org> |
|---|---|
| date | Mon, 25 Feb 2013 18:23:37 +0100 |
| parents | 836e4e110c71 |
| children | 7d72fb45b1e4 |
comparison
equal
deleted
inserted
replaced
| 915:1d03dc7cf28f | 916:9c5573b389c0 |
|---|---|
| 67 if not pcall(function() req_body = json_decode(body) end) then | 67 if not pcall(function() req_body = json_decode(body) end) then |
| 68 module:log("debug", "JSON data submitted for user registration by %s failed to Decode.", user) | 68 module:log("debug", "JSON data submitted for user registration by %s failed to Decode.", user) |
| 69 return http_response(event, 400, "JSON Decoding failed.") | 69 return http_response(event, 400, "JSON Decoding failed.") |
| 70 else | 70 else |
| 71 -- Decode JSON data and check that all bits are there else throw an error | 71 -- Decode JSON data and check that all bits are there else throw an error |
| 72 req_body = json_decode(body) | |
| 73 if req_body["username"] == nil or req_body["password"] == nil or req_body["host"] == nil or req_body["ip"] == nil then | 72 if req_body["username"] == nil or req_body["password"] == nil or req_body["host"] == nil or req_body["ip"] == nil then |
| 74 module:log("debug", "%s supplied an insufficent number of elements or wrong elements for the JSON registration", user) | 73 module:log("debug", "%s supplied an insufficent number of elements or wrong elements for the JSON registration", user) |
| 75 return http_response(event, 400, "Invalid syntax.") | 74 return http_response(event, 400, "Invalid syntax.") |
| 76 end | 75 end |
| 77 -- Check if user is an admin of said host | 76 -- Check if user is an admin of said host |
