Ignore:
Timestamp:
Jun 27, 2013 4:37:33 PM (11 years ago)
Author:
potar
Message:

disable in-line validation for captcha

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha/widget.py

    r3137 r3688  
    1616from Products.CMFCore.interfaces import ISiteRoot 
    1717 
    18 from quintagroup.captcha.core.utils import decrypt, parseKey, encrypt1, getWord 
     18from quintagroup.captcha.core.utils import (decrypt, parseKey, 
     19                                            encrypt1, getWord, 
     20                                            detectInlineValidation) 
     21 
     22try: 
     23    from plone.app.form import inline_validation 
     24except ImportError: 
     25    # BBB Plone < 4.3 compatibility. 
     26    # The implementation of inline validation was switched 
     27    # to a non-KSS-based in plone.app.form-2.2.0 
     28    from plone.app.form.kss import validation as inline_validation 
    1929 
    2030_ = MessageFactory('quintagroup.formlib.captcha') 
     
    6373 
    6474    def _toFieldValue(self, input): 
    65         # Verify the user input against the captcha 
     75        # Captcha validation is one-time process to prevent hacking 
     76        # This is the reason for in-line validation to be disabled. 
     77        if detectInlineValidation(inline_validation): 
     78            return input 
    6679 
    67         # get captcha type (static or dynamic) 
     80        # Verify the user input against the captcha. 
     81        # Get captcha type (static or dynamic) 
    6882        site = self.get_site() 
    6983        captcha_type = site.getCaptchaType() 
Note: See TracChangeset for help on using the changeset viewer.