source: products/quintagroup.captcha.core/trunk/quintagroup/captcha/core/skins/captcha_core/dynamic/getCaptcha.py @ 1993

Last change on this file since 1993 was 1993, checked in by mylan, 14 years ago

#172: Fix bug in dynamic captcha: when in getCaptcha method randint return maximum number - leed to IndexError?

File size: 488 bytes
Line 
1## Script (Python) "getCaptcha"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9from quintagroup.captcha.core.utils import getCaptchasCount, formKey, encrypt
10
11from random import randint
12# *randint* return random integer in range [a, b],
13# including *both* end points.
14key = formKey(randint(0, getCaptchasCount(True)-1))
15encrypted_key = encrypt(context.captcha_key, key)
16
17return encrypted_key
Note: See TracBrowser for help on using the repository browser.