Ignore:
Timestamp:
7 Dec 2011, 15:46:35 (13 years ago)
Author:
uli
Message:

Make recaptcha keys instance attributes for better customization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/captcha.py

    r7303 r7305  
    238238API_SSL_SERVER = "https://www.google.com/recaptcha/api"
    239239VERIFY_SERVER = "https://www.google.com/recaptcha/api"
    240 # Do not use the following keys in productive environments!
    241 # As they are both made publicly available, they are not secure any more!
    242 # Use them for testing and evaluating only!
    243 PUBLIC_KEY = "6Lc0y8oSAAAAAHwdojrqPtcKn7Rww5qGprb0rrSk"
    244 PRIVATE_KEY = "6Lc0y8oSAAAAAMHVbMrGWLLjw2pm8v2Uprwm9AbR"
    245240
    246241class ReCaptcha(StaticCaptcha):
     242    """ReCaptcha - strong captchas with images, sound, etc.
     243
     244    This is the SIRP implementation to support captchas as provided by
     245    http://www.google.com/recaptcha.
     246
     247    ReCaptcha is widely used and adopted in web applications
     248    """
    247249
    248250    grok.implements(ICaptcha)
     
    252254    #: name of challenge field in HTTP request
    253255    chal_field = 'recaptcha_challenge_field'
     256
     257    # Do not use the following keys in productive environments!  As
     258    # they are both made publicly available, they are not secure any
     259    # more!  Use them for testing and evaluating only!
     260    PUBLIC_KEY = "6Lc0y8oSAAAAAHwdojrqPtcKn7Rww5qGprb0rrSk"
     261    PRIVATE_KEY = "6Lc0y8oSAAAAAMHVbMrGWLLjw2pm8v2Uprwm9AbR"
    254262
    255263    def verify(self, request):
     
    264272        params = urllib.urlencode(
    265273            {
    266                 'privatekey': PRIVATE_KEY,
     274                'privatekey': self.PRIVATE_KEY,
    267275                'remoteip': '127.0.0.1',
    268276                'challenge': challenge,
     
    308316            u'</noscript>' % {
    309317                'ApiServer' : API_SSL_SERVER,
    310                 'PublicKey' : PUBLIC_KEY,
     318                'PublicKey' : self.PUBLIC_KEY,
    311319                'ErrorParam' : error_param,
    312320                }
Note: See TracChangeset for help on using the changeset viewer.