Mercurial > prosody-modules
diff mod_register_web/mod_register_web.lua @ 2999:d631fd9a3300
mod_register_web: Handle errors contacting upstream API
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 15 Apr 2018 12:39:32 +0100 |
parents | 3a104a900af1 |
children | 866167118d23 |
line wrap: on
line diff
--- a/mod_register_web/mod_register_web.lua Sat Apr 07 01:41:01 2018 +0200 +++ b/mod_register_web/mod_register_web.lua Sun Apr 15 12:39:32 2018 +0100 @@ -58,7 +58,10 @@ }; }, function (verify_result, code) local result = json(verify_result); - if result.success == true then + if not result then + module:log("warn", "Unable to decode response from recaptcha: [%d] %s", code, verify_result); + callback(false, "Captcha API error"); + elseif result.success == true then callback(true); else callback(false, t_concat(result["error-codes"]));