Changeset 3690 in products


Ignore:
Timestamp:
Jul 3, 2013 9:52:00 AM (11 years ago)
Author:
potar
Message:

The captcha field was made required for preventing hacks

File:
1 edited

Legend:

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

    r3688 r3690  
    7272                                                     key) 
    7373 
     74    def hasInput(self): 
     75        # The validator looks for the captcha only if the captcha field 
     76        # is present. If the captcha field is omitted from the request, 
     77        # then the captcha validation never happens. That's why 'required' 
     78        # option is useless. So, we have to simulate 'required': set up 'True' 
     79        # for the captcha input. 
     80        return True 
     81 
     82    def _getFormInput(self): 
     83        """ It returns current form input. """ 
     84        # The original method isn't suitable when the captcha field  
     85        # is omitted from the request. 
     86        return self.request.get(self.name, u'') 
     87 
    7488    def _toFieldValue(self, input): 
    7589        # Captcha validation is one-time process to prevent hacking 
Note: See TracChangeset for help on using the changeset viewer.