Software /
code /
prosody-modules
Changeset
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 | 2998:719b76ee0578 |
children | 3000:02fc3b64cbb7 |
files | mod_register_web/mod_register_web.lua |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
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"]));