Zend FR

Consultez la FAQ sur le ZF avant de poster une question

Vous n'êtes pas identifié.

#1 21-12-2009 10:06:13

aquaa
Membre
Date d'inscription: 26-06-2009
Messages: 10

Rafraichir un Zend_Form_Element_Captcha

Bonjour,

comment pourrais-je ajouter un captcha "reload" ?
en JavaScript je sais, mais comment devrais-je gérer cela avec le ZF?
Je génère le captcha avec Zend_Form_Element_Captcha comme une image.

Merci d'avance

Hors ligne

 

#2 21-12-2009 12:39:08

elec
Membre
Date d'inscription: 16-10-2009
Messages: 118

Re: Rafraichir un Zend_Form_Element_Captcha

Bonjour,

Bon c'est très simple,tu commence tout d'abord par l'inscription pour avoir un compte sur  http://recaptcha.net/ et puis pour obtenir deux clés "pubKey"  et "privKey" ,tu mets les clés dans ton formulaire:

Code:

$pubKey = 'ici le code';
$privKey = 'et encore ici';
$recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey);
$adapter = new Zend_Captcha_ReCaptcha();
$adapter->setService($recaptcha);
$captcha = new Zend_Form_Element_Captcha('recaptcha', array( 'label' => "Captcha", 'captcha' => $adapter));
$captcha->removeDecorator('label')->removeDecorator('errors');

et voilà ton "captcha" est activéwink.Finalement pour personnaliser l'apparence du "captcha",je n'ai pas une idée  pour le moment mais je pense en utilisant javascript.

A+.Nll

Dernière modification par elec (21-12-2009 12:58:39)

Hors ligne

 

#3 21-12-2009 14:07:10

aquaa
Membre
Date d'inscription: 26-06-2009
Messages: 10

Re: Rafraichir un Zend_Form_Element_Captcha

Merci
en faite j'utilisais pas le recaptcha c'est plutot

Code:

        $captcha = new Zend_Form_Element_Captcha ( 'captcha', // This is the name of the input field  
        
        array ('label' => 'Write the chars to the field', 'captcha' 
        => array (// Here comes the magic... 
         // First the type...  
        'captcha' => 'Image', // Length of the word...  
        'wordLen' => 6, // Captcha timeout, 5 mins  
        'timeout' => 300, // What font to use...  
        'font' => APPLICATION_PATH.'/../application/utils/font/QuantasRegular.ttf', // Where to put the image  
        'imgDir' => APPLICATION_PATH.'/../application/utils/images/', // URL to the images  
        // This was bogus, here's how it should be... Sorry again :S  
        'imgUrl' => $config->production->siteName.'/athentification/application/utils/images/' ) ) );
        /*$captcha->setCaptcha('Dumb')
                 ->setIgnore(true);*/

Hors ligne

 

Pied de page des forums

Propulsé par PunBB
© Copyright 2002–2005 Rickard Andersson
Traduction par punbb.fr

Graphisme réalisé par l'agence Rodolphe Eveilleau
Développement par Kitpages