comparison mod_register_web/mod_register_web.lua @ 3679:f9a93d7b6c50

mod_register_web: Fix traceback if captcha_reply is left out of the form (thanks woffs)
author Kim Alvefur <zash@zash.se>
date Sat, 28 Sep 2019 21:26:28 +0200
parents 866167118d23
children 1c3c7d73c5a6
comparison
equal deleted inserted replaced
3678:7575399ae544 3679:f9a93d7b6c50
99 return captcha_tpl.apply { 99 return captcha_tpl.apply {
100 op = op, x = x, y = y, challenge = challenge; 100 op = op, x = x, y = y, challenge = challenge;
101 }; 101 };
102 end 102 end
103 function verify_captcha(request, form, callback) 103 function verify_captcha(request, form, callback)
104 if hmac_sha1(secret, form.captcha_reply, true) == form.captcha_challenge then 104 if hmac_sha1(secret, form.captcha_reply or "", true) == form.captcha_challenge then
105 callback(true); 105 callback(true);
106 else 106 else
107 callback(false, "Captcha verification failed"); 107 callback(false, "Captcha verification failed");
108 end 108 end
109 end 109 end