Changeset 639
- Timestamp:
- 11/17/06 14:04:27
- Files:
-
- qPloneCaptchas/trunk/CaptchaTool.py (added)
- qPloneCaptchas/trunk/Extensions/Install.py (modified) (2 diffs)
- qPloneCaptchas/trunk/README.txt (modified) (2 diffs)
- qPloneCaptchas/trunk/__init__.py (modified) (2 diffs)
- qPloneCaptchas/trunk/config.py (modified) (1 diff)
- qPloneCaptchas/trunk/skins/captchas_qcomments (deleted)
- qPloneCaptchas/trunk/tool.gif (added)
- qPloneCaptchas/trunk/utils.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneCaptchas/trunk/Extensions/Install.py
r638 r639 34 34 35 35 DiscussionLayer = LAYER_DISCUSSION 36 if qi.isProductInstalled('qPloneComments'):37 DiscussionLayer = LAYER_QCOMMENTS38 36 if qi.isProductInstalled('PloneFormMailer'): 39 37 formmailer_layer = LAYER_FORMMAILER+'/'+plone_version … … 77 75 if (l == skin) or (l.startswith(skin+'/')): 78 76 path.remove(l) 77 79 78 skinstool.addSkinSelection(skinName, ','.join(path)) 80 79 qPloneCaptchas/trunk/README.txt
r638 r639 1 qPloneCaptchas is simple captchas implementasion for Plone, designed for validation human input in unsecure forms. This is standalone implementation with static and dynamiccaptcha images, which does not depend on captchas.net services.1 qPloneCaptchas is simple captchas implementasion for Plone, designed for validation human input in unsecure forms. This is standalone implementation with static captcha images, which does not depend on captchas.net services. 2 2 3 3 Supported Plone versions: … … 14 14 Install: 15 15 16 *If qPloneCaptchas is expected to be used with qPloneComments or PloneFormMailer please make sure that qPloneCaptchas installed only after these products.16 If qPloneCaptchas is expected to be used with qPloneComments or PloneFormMailer please make sure that qPloneCaptchas installed only after these products. 17 17 18 18 Authors: 19 19 20 *Volodymyr Cherepanyak - chervol@quintagroup.com21 *Mykola Kharechko - crchemist@quintagroup.com20 Volodymyr Cherepanyak - chervol@quintagroup.com 21 Mykola Kharechko - crchemist@quintagroup.com 22 22 23 23 Future: 24 25 * Options for captchas images generation24 * Dynamic captchas option implementation depending on PIL presence. 25 * Options for captchas images generation qPloneCaptchas/trunk/__init__.py
r638 r639 1 1 from Products.CMFCore.DirectoryView import registerDirectory 2 from Products.CMFCore.utils import ToolInit 2 3 from AccessControl import allow_module 3 4 import config 5 import CaptchaTool 4 6 allow_module('Products.qPloneCaptchas.utils') 5 7 allow_module('Products.qPloneCaptchas.config') … … 12 14 13 15 registerDirectory('skins', config.GLOBALS) 16 tools = (CaptchaTool.CaptchaTool, ) 17 def initialize(context): 18 ToolInit("CaptchaTool", tools=tools, icon=config.TOOL_ICON).initialize(context) qPloneCaptchas/trunk/config.py
r638 r639 3 3 CAPTCHAS_COUNT = 165 4 4 LAYERS = ['captchas', 'plone_captchas'] 5 LAYER_QCOMMENTS = 'captchas_qcomments'6 5 LAYER_DISCUSSION = 'captchas_discussion' 7 6 LAYER_FORMMAILER = 'captchas_ploneformmailer' 8 ALL_LAYERS = LAYERS + [LAYER_QCOMMENTS, LAYER_DISCUSSION, LAYER_FORMMAILER] 7 ALL_LAYERS = LAYERS + [LAYER_DISCUSSION, LAYER_FORMMAILER] 8 TOOL_ICON = 'tool.gif' 9 TOOL_ID = 'portal_captchas' 9 10 havePIL = True qPloneCaptchas/trunk/utils.py
r638 r639 91 91 92 92 def encrypt(key, s): 93 return Crypto.new(key).encrypt(s).encode("hex")93 return toHex(Crypto.new(key).encrypt(s)) 94 94 95 95 def decrypt(key, s): 96 return Crypto.new(key).decrypt( s.decode("hex"))96 return Crypto.new(key).decrypt(toStr(s)) 97 97 98 98 def parseKey(s): … … 103 103 context.portal_captchas.new(key) 104 104 105 def toHex(s): 106 lst = [] 107 for ch in s: 108 hv = hex(ord(ch)).replace('0x', '') 109 if len(hv) == 1: 110 hv = '0'+hv 111 lst.append(hv) 112 113 return reduce(lambda x,y:x+y, lst) 114 115 def toStr(s): 116 return s and chr(atoi(s[:2], base=16)) + toStr(s[2:]) or ''
