Software /
code /
prosody-modules
Changeset
1231:502ce9672eae
mod_register_web: Use local
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 30 Nov 2013 20:29:21 +0100 |
parents | 1230:f7c561fbd5a6 |
children | 1232:12f59489ef6e |
files | mod_register_web/mod_register_web.lua |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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