예제 #1
0
    def render_GET(self, request):
        # get a captcha
        c = Raptcha(self.recaptchaPubKey, self.recaptchaPrivKey)
        c.get()

        # TODO: this does not work for versions of IE < 8.0
        imgstr = 'data:image/jpeg;base64,%s' % base64.b64encode(c.image)
        return lookup.get_template('captcha.html').render(imgstr=imgstr, challenge_field=c.challenge)
예제 #2
0
    def render_GET(self, request):
        if self.useRecaptcha:
            # get a captcha
            c = Raptcha(self.recaptchaPubKey, self.recaptchaPrivKey)
            c.get()

            # TODO: this does not work for versions of IE < 8.0
            imgstr = 'data:image/jpeg;base64,%s' % base64.b64encode(c.image)
            HTML_CAPTCHA_TEMPLATE = self.buildHTMLMessageTemplateWithCaptcha(
                getLocaleFromRequest(request), c.challenge, imgstr)
            return HTML_CAPTCHA_TEMPLATE
        else:
            return self.getBridgeRequestAnswer(request)
예제 #3
0
파일: Server.py 프로젝트: aagbsn/bridgedb
    def render_GET(self, request):
        if self.useRecaptcha:
            # get a captcha
            c = Raptcha(self.recaptchaPubKey, self.recaptchaPrivKey)
            c.get()

            # TODO: this does not work for versions of IE < 8.0
            imgstr = "data:image/jpeg;base64,%s" % base64.b64encode(c.image)
            HTML_CAPTCHA_TEMPLATE = self.buildHTMLMessageTemplateWithCaptcha(
                getLocaleFromRequest(request), c.challenge, imgstr
            )
            return HTML_CAPTCHA_TEMPLATE
        else:
            return self.getBridgeRequestAnswer(request)