comparison mod_register_json/mod_register_json.lua @ 356:5dacfbc9cd86

mod_register_json: Fixed missing close quote.
author Marco Cirillo <maranda@lightwitch.org>
date Tue, 12 Apr 2011 15:36:30 +0000
parents a5da789b2e7d
children 59345fd38ad9
comparison
equal deleted inserted replaced
355:a5da789b2e7d 356:5dacfbc9cd86
51 -- Various sanity checks. 51 -- Various sanity checks.
52 if req_body == nil then module:log("debug", "JSON data submitted for user registration by %s failed to Decode.", user); return http_response(400, "JSON Decoding failed."); end 52 if req_body == nil then module:log("debug", "JSON data submitted for user registration by %s failed to Decode.", user); return http_response(400, "JSON Decoding failed."); end
53 if req_body["password"]:match("%s") then module:log("debug", "Password submitted for user registration by %s contained spaces.", user); return http_response(400, "Supplied user passwords can't contain spaces."); end 53 if req_body["password"]:match("%s") then module:log("debug", "Password submitted for user registration by %s contained spaces.", user); return http_response(400, "Supplied user passwords can't contain spaces."); end
54 -- We first check if the supplied username for registration is already there. 54 -- We first check if the supplied username for registration is already there.
55 if not usermanager.user_exists(req_body["username"], req_body["host"]) then 55 if not usermanager.user_exists(req_body["username"], req_body["host"]) then
56 usermanager.create_user(req_body["username"], req_body["password"], req_body["host]); 56 usermanager.create_user(req_body["username"], req_body["password"], req_body["host"]);
57 module:log("debug", "%s registration data submission for %s is successful", user, req_body["user"]); 57 module:log("debug", "%s registration data submission for %s is successful", user, req_body["user"]);
58 return http_response(200, "Done."); 58 return http_response(200, "Done.");
59 else 59 else
60 module:log("debug", "%s registration data submission for %s failed (user already exists)", user, req_body["user"]); 60 module:log("debug", "%s registration data submission for %s failed (user already exists)", user, req_body["user"]);
61 return http_response(409, "User already exists."); 61 return http_response(409, "User already exists.");