# HG changeset patch # User Kim Alvefur # Date 1385839761 -3600 # Node ID 502ce9672eae0ce416ec68673cc14f71cb3b42cc # Parent f7c561fbd5a62f1f3ecd4d9e74b44ce85d239214 mod_register_web: Use local diff -r f7c561fbd5a6 -r 502ce9672eae mod_register_web/mod_register_web.lua --- a/mod_register_web/mod_register_web.lua Sat Nov 30 20:28:07 2013 +0100 +++ b/mod_register_web/mod_register_web.lua Sat Nov 30 20:29:21 2013 +0100 @@ -55,15 +55,16 @@ end else module:log("debug", "No Recaptcha options set, using fallback captcha") + local random = math.random; local hmac_sha1 = require "util.hashes".hmac_sha1; local secret = require "util.uuid".generate() local ops = { '+', '-' }; local captcha_tpl = get_template "simplecaptcha"; function generate_captcha() - local op = ops[math.random(1, #ops)]; - local x, y = math.random(1, 9) + local op = ops[random(1, #ops)]; + local x, y = random(1, 9) repeat - y = math.random(1, 9); + y = random(1, 9); until x ~= y; local answer; if op == '+' then