[TYPO3-project-formidable] Captcha renderlet

Luc Muller l.mul-nospam-ler at ameos.com
Fri Jun 1 14:16:15 CEST 2007


Yep, there's no need of a "validator"
it make no-sense, a captcha is "by definition" a validation system.
so it HAS to validate.
in this way you don't have to tell it to validate.
You don't need more XML conf than i gave you.
the piece of XML I gave is the "most complex" you can have for a captcha.
as you can see, error_message is already included...
in the htmlbag, you can call :
captcha.label -> this is the label for the captcha eg : validaiton service
captcha.input -> this is the text field
captcha.image -> this is the generated image
captcha.reloadpic -> this is the relaod gif
captcha.copylabel -> this is the text where you can tell something like : 
"please copy the code...."

well, I think my conf need some explanation,

>>   <renderlet:CAPTCHA name="captcha">
>>    <custom>class="texte"</custom>
>>    <label>Un label a la noix de présentation</label>
>>    <copylabel>Copie le code</copylabel>
>>    <errormessage>Errruuuuueerrrr</errormessage>
>>    <reloadpic>EXT:ameos_t3con06/res/img/reload.png</reloadpic>
>>    <width>100</width> -> width of the image in px
>>    <height>30</height> -> height of the image in px
>>    <frame>false</frame> -> border of the image
>>    <bgcolor>255,255,255</bgcolor> -> background color RGB
>>    <transparent_background>false</transparent_background> <font> -> 
>> special conf for the font
>>     <fontcolor>
>>      <random>true</random>
>>      <level>darker</level> if true, you can specify lighter, light, dark, 
>> darker
>>     </fontcolor>
>>     <family>Alanden_,luggerbu.ttf</family>
>>     <size>12</size>
>>    </font>
>>    <authchar>AZ</authchar> List of characters used in the captcha default 
>> ABCDEFGHIJKLMNOPQRSTUVWXYZ
>>    <crypteasy> -> this makes the captcha more readable while ordering the 
>> letters alternatively with a consonnant then a vowel and so on
>>     <con>ZH</con> -> these are the consonnants who are going to be used 
>> with crypt easy
>>     <vow>AU</vow> -> these are the vowels who are going to be used with 
>> crypt easy
>>    </crypteasy>
>>    <difuplow>false</difuplow> -> this says if UPPERCASE and lowercase 
>> make a difference in the captcha validation
>>    <nbchar>5</nbchar> -> nbr of letters to display in the captcha
>>    <charspace>20</charspace> -> space between characters
>>    <charangle>10</charangle> -> angle of variation for each characters
>>    <charup>true</charup> possible vertical deviation of each characters
>>    <noise> -> special conf for the "noise"
>>     <pixel>200</pixel> -> number of pixel added to the captcha, can be a 
>> range (eg 1-1000 -> 1 to 1000 px, can be more)
>>     <line>3</line> -> number of line added to the captcha, can be a range 
>> (eg 1-5 -> 1 to 5 line, can be more)
>>     <noisecolor>charcolor</noisecolor> -> color used for the noise, can 
>> be either charcolor or backcolor
>>    </noise>
>>    <imgtype>png</imgtype> -> img type can be jpg, gif or png
>>    <cryptsecure>md5</cryptsecure> -> type of hash that is used with the 
>> captcha, can be either, md5 or sha1
>>    <timer>
>>     <time>0</time> -> time that must be spent before the user can reload 
>> the captcha
>>     <action>image</action> -> action to make when reloading :image means 
>> having a new captcha
>>    </timer>
>>    <maxattempt>1000000000000</maxattempt> -> number of attempt before 
>> blocking the captcha
>>   </renderlet:CAPTCHA>

"Ivan Gomez Rodriguez" <igomez at igalia.com> a écrit dans le message de news: 
mailman.290437.1180698549.21067.typo3-project-formidable at lists.netfielders.de...
> Hello again:
>
> Thanks you, Luc, renderlet is working.
>
> But now, i'm trying with the captcha validator and something isn't working 
> fine,  validator shows always the error message.
>
> That's my xml's piece :
>
>
>  <renderlet:CAPTCHA name="captcha">
>   <!--custom>class="texte"</custom-->
>   <label>Un label a la noix de présentation</label>
>   <copylabel>Copie le code</copylabel>
>   <errormessage>Errruuuuueerrrr</errormessage>
>   ....
>
>    BLA, BLA,BLA
>   ....
>
>   <validators>
>           <validator:CAPTCHA name="captcha" message="AAAAA"/> 
> </validators>
>
>
> That's rigth?
>
> I was looking in the code and i suspect that problem could be here.
> There aren't  keys  prefixed by 'sr_freecap'  in $_SESSION array, when 
> following function is called.
>
> tx_srfreecap_pi2 :
>
>    function checkWord($word) {
>        session_start();
>      if (!empty($_SESSION[$this->extKey . '_word_hash']) && !empty($word)) 
> {        // all freeCap words are lowercase.
>            // font #4 looks uppercase, but trust me, it's not...
>            if ($_SESSION[$this->extKey . '_hash_func'] == 'md5') {
>                if (md5(strtolower($word)) == $_SESSION[$this->extKey . 
> '_word_hash']) {
>                    // reset freeCap session vars
>                    // cannot stress enough how important it is to do this
>                    // defeats re-use of known image with spoofed session 
> id
>                    $_SESSION[$this->extKey . '_attempts'] = 0;
>                    $_SESSION[$this->extKey . '_word_hash'] = false;
>                    return true;
>                }
>            }
>        }
>        return false;
>    }
>
> Does somebody  know why it doesn't work?.
>
>
> Luc Muller wrote:
>> You can use it like this :  <renderlet:CAPTCHA />
>> this would result in a default mode.
>>
>> Or using something more complex like :
>>
>>   <renderlet:CAPTCHA name="captcha">
>>    <custom>class="texte"</custom>
>>    <label>Un label a la noix de présentation</label>
>>    <copylabel>Copie le code</copylabel>
>>    <errormessage>Errruuuuueerrrr</errormessage>
>>    <reloadpic>EXT:ameos_t3con06/res/img/reload.png</reloadpic>
>>    <width>100</width>
>>    <height>30</height>
>>    <frame>false</frame>
>>    <bgcolor>255,255,255</bgcolor>
>>    <transparent_background>false</transparent_background>
>>    <font>
>>     <fontcolor>
>>      <random>true</random>
>>      <level>darker</level>
>>     </fontcolor>
>>     <family>Alanden_,luggerbu.ttf</family>
>>     <size>12</size>
>>    </font>
>>    <authchar>AZ</authchar>
>>    <crypteasy>
>>     <con>ZH</con>
>>     <vow>AU</vow>
>>    </crypteasy>
>>    <difuplow>false</difuplow>
>>    <nbchar>5</nbchar>
>>    <charspace>20</charspace>
>>    <charangle>10</charangle>
>>    <charup>true</charup>
>>    <noise>
>>     <pixel>200</pixel>
>>     <line>3</line>
>>     <noisecolor>charcolor</noisecolor>
>>    </noise>
>>    <imgtype>png</imgtype>
>>    <cryptsecure>md5</cryptsecure>
>>    <timer>
>>     <time>0</time>
>>     <action>image</action>
>>    </timer>
>>    <maxattempt>1000000000000</maxattempt>
>>   </renderlet:CAPTCHA>
>>
>> This is the most complex way to use the CAPTCHA but you can only use 
>> config that you need.
>> if everything is correct, all config you didn't specified, will be set by 
>> default.
>>
>> Hope this helps.
>>
>> Luc =:0)
>> "Ivan Gomez Rodriguez" <igomez at igalia.com> a écrit dans le message de 
>> news: 
>> mailman.290101.1180688368.21067.typo3-project-formidable at lists.netfielders.de...
>>
>>> Hello,
>>>
>>> I'm trying to use captcha renderlet and validator in order to use in a 
>>> registration form, but i have no idea about configuring it.
>>>
>>> Knows somebody where i can find examples or doc about this element?.
>>>
>>> Thanks in advance.
>>>
>>> --
>>>
>>> Iván Gómez Rodríguez
>>> Ingeniero en Informática
>>> mailto:igomez at igalia.com
>>> Telf:  +34 986 10 76 10
>>> Fax:   +34 981 91 39 49
>>> Igalia http://www.igalia.com
>>
>>
>>   ------------------------------------------------------------------------
>>
>> _______________________________________________
>> TYPO3-project-formidable mailing list
>> TYPO3-project-formidable at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable 




More information about the TYPO3-project-formidable mailing list