Home
Wed
18
Oct

Upgrade: JCCreCaptcha 2.0b

Attention: open in a new window. PDFPrintE-mail

Paths to the 2.0b release

 

To use the JCCreCaptcha on a page formulary requires the location of two points on the source code of this form. On each it's points we have to make a call to the plugin, to:

1) Show the reCaptcha user interface;

 

2) Validate the captcha answer, accepting or rejecting the “request”.

 

To locate these source code points and to insert the JCCreCaptcha integration code isn't a complicated task to someone with the basic PHP programming skills, but, those that haven't these skills feel great difficulty to make use of the JCCreCaptcha plugins, in this way.

 

As punctually answer to the requests to use reCaptcha with core Joomla contact component, we provided the 1.01 release.

 

This upgrade enable a non programmer user, through additional plugin and parameters, to insert the reCaptcha's interface on the Joomla core contact's formulary. It will enable too the consequent validation of the attempts of reCaptcha's answers.

 

Thinking extend this behaviour to all other Joomla formularies (from the core components to the extensions components), since they to follow some basic Joomla standards, that I have employed all available time to develop a "no-code" solution to inject and validate reCaptcha.

 

This solution is the 2.0b Release, that I'm pleased to post today.

 

 

Injecting the reCaptcha's Interface on any formulary

 

First of all, it's necessary to make clear that there aren't a magical solution to this problem.

 

Any "no-code" solution, need to be based on some assumptions to compensate for the loss of the flexibility that you have when you work with source code.

 

In the case of reCaptcha insertion, these assumptions are:

 

a) The formulary that we want to protect need to be activated by a menu option;

 

b) The user need to define the name of one of formulary's field. The reCaptcha's interface will be positionated relative to it;

 

 

mod_JCCreCaptchaPlacer

 

The 1.01 release users will notice that the JCCreCaptchaCV was substituted for the mod_JCCreCaptchaPlacer module, in the 2.0b Release.

 

The JCCreCaptchaPlacer's purpose is to define on which page is the formulary that we need to protect with reCaptha and on which of it's part the reCaptcha's interface will be showed to the user.

 

To use it we have to follow the steps below:

 

1. Put the module in the upper area of your template:

 

Don't mind about your design. This is a invisible module. It works only on the “backstage”.

 

JCCreCaptchaPlacer - Posicionando o módulo

 

 

2. On the “Menu Assignment”'s properties, select the menu option created to access the wanted formulary:

JCCreCaptchaPlacer - Selecionando o menu

 

On the sample above, we created, before, a menu option “Registre-se”, and we selected the “Default Registration Layout” for its “Menu Type” property. It corresponds to the User registration view of the Joomla 1.5 core user component.

 

 

3. Configure the position of the reCaptcha, relative to one of it's fields:

 

JCCreCaptchaPlacer - Parâmetros

 

On the “Form Item ID” parameter we put the ID of the formulary's field that will base the position of the reCaptcha

 

The “Position” parameter determine the relative location of the reCaptcha based on the “Form Item ID” field. Its options are “After”, “Before” and “Inner”.

 

Note: The “Inner” option can only be used for the containers HTML fields, like DIV, by example.

 

 

4. Configure the formulary's fields that have to be persisted:

 

This is a optional step.

 

Ever that a user misses a try to answer a reCaptcha, the request is returned to the formulary page that originated it, with a error message. If you don't configure the "Restore Field List" parameter, the user will have to redigit all the formulary's fields, except if that formulary have itself persistence mechanism.

 

You can determine the fields wich content must to be persisted between a try and a error return. The parameter is filled with the IDs of the formularys fields that we want persist, separated by point and comma, (without spaces)

 

 

5. PAUSE 1: How to discover the names and IDs of the formulary's fields:

 

The method that I will present uses a behaviour of Google Chrome, the browser that I use.

 

It's provable that the users of the Firefox have some feature like it. About the IE, the only similar behaviour that I know is view and read the HTML source-code of the page.

 

Let's go:

 

- Browse to the formulary page;

 

- With a right-click over the field whose ID we want to know, select the “Inspect Element”;

 

- Look the tag html that generate that field. We will use its "ID" property value;

 

JCCreCaptchaPlacer - Descobrindo nomes de campos

 

 

 

6. Save the changes. The first step to insert the reCaptcha is done!

 

 

Inserting the validation of the reCaptcha

 

The JCCreCaptcha's assumptions, when it act with mod_JCCreCaptchaPlacer, are:

 

a) All Joomla 1.5 formularies use the same structure to execute actions, after its fill;

 

b) The user can to specify the Joomla component of the formulary;

 

c) The user can to specify the action name that corresponds to the send of that formulary.

 

 

JCCreCaptcha 2.0b

 

Notice: who want continue to use the JCCreCaptcha 2.0b, by code, can to do it normally. Its code interface is the same from the 1.0 release.

 

So, its configuration to use by the "no-code" perspective are:

 

1. After install the new release, open its parameters interface:

 

JCCreCaptcha - Parâmetros

 

Note: We don't talk about the parameters that already was in the previous releases. If you have any doubts see the previous posts, since the 1.0 release.

 

 

2. Configure the new “Blocked Tasks” parameter:

 

The “Blocked Tasks” must be filled with a pair of values. The first is the internal name of the Joomla component whose protected formulary belongs to.

 

The second value, must be filled with the “Task” name used to execute the send of the formulary.

 

Both the values must be separated by comma.

 

 

3. PAUSE 2: How to discover the component name:

 

This is very easy. When create the menu option, see the values that follow the "option" token, on the field "link" of “Menu Item Details”:

 

JCCreCaptcha - Descobrindo o nome do componente

 

On the picture above, we show the parameters of the menu “Registre-se” that we created to this example.

 

 

4. PAUSE 3: How to discover the "Task" name associated to the send of the formulary:

 

We will use the Google Chrome's “Inspect element” behaviour, once time more. Select the last formulary's field and look for a hidden field named “task”:

 

JCCreCaptcha - Descobrindo o nome da task

 

The “Blocked Tasks” second parameter's is the content of the value parameter of the HTML tag that define this hidden field.

 

So, the “Blocked Tasks” configuration, to our sample, will be:

 

“com_user,register_save”

 

 

Results of the Sample Configuration

 

1. Formulary “Registre-se” with reCaptcha “injected”;

 

JCCreCaptcha - Registre com JCCreCaptcha

 

 

2. Send with wrong Captcha's answer:

 

JCCreCaptcha - Solução do Captcha incorreta

 

3. Correct Captcha's answer:

 

 

JCCreCaptcha - Retorno para o formulário

 

 

4. Correct Captcha's answer result :

 

JCCreCaptcha - Resposta ao Preenchimento Correto

 

 

JCCreCaptcha 2.0b Advanced Topics

 

Using the reCaptcha in two or more formularies

 

mod_JCCreCaptchaPlacer

 

 

1. Create a new module from the module mod_JCCreCaptchaPlacer:

 

- On the Joomla's backend interface, click on “Module Manager” command of “Extensions” menu:

 

- On “Module Manager”, click on button “New”. This will open the list of the modules from which you can create a new module. Select the “JCC reCaptcha Placer Module” and click on “Next” button;

 

JCCreCaptchaPlacer - Instanciando o módulo

 

2. Ready: now, with your new module, you can use it to indicate another page and position to JCCreCaptcha to be used.

 

 

JCCreCaptcha 2.0b

 

1. The “Blocked Tasks”'s participation

 

As previously seen, each protected formulary must be configurated on the “Blocked Tasks” parameter, to it be really protected.

 

The “Blocked Tasks” parameter can receive more than one “task” simultaneously. All we have to do is separate each pair of component and task that specify one form, with point and comma, as seen in the example down:

 

com_user,register_save;com_contact,register

 

 

“Restore Field List” x ID x NAME

 

mod_JCCreCaptchaPlacer

 

On HTML, each element (the formulary fields, by example) can have two “names”. One is defined by the “Name” argument of the HTML tags that create the element. Another is defined by the "ID" argument. Frequently a element use only one of two arguments or use both with the same value, but it can use both with different values too. To fill the “Restore Field List” parameter, in this case, we do the follow.

 

[ID' field1], [NAME's field1]; [ID's field2],[NAME's field2]; (etc...)

 

A sample of these situations is the Joomla core contact formulary. Inspect the names and IDs of the fields of its formulary and compare with the correct fill down:

 

“contact_name,name;contact_email,email;contact_subject,subject;contact_text,text”

 

 

Downloads & Article's Links

 

The software is available "as is". No warranty, or support will be provided. The software is available on the terms of GNU-GPL license. Know its terms here.

 

Update: JCCreCaptcha 2.01b
The last plugin's update, it fix a installation bug that occurs on some environments. See it before to download this page release!

 

ExtensionsJCCreCaptcha2.0b.zip
ZIP with the extensions JCCreCaptcha and JCCreCaptchaPlacer. Unzip before install!

 

 

Finalizing

 

Despite the integration of JCCreCaptcha to any formulary be simple through source code, it requires some PHP knowhow to determine the locals to insert the JCCreCaptcha integration code.

 

With the way to do adopted by this release, we can to do the reCaptcha's "injection" on formularies, based on few prerequisites that are: to have a menu option that particularizes the formulary and to know the IDs of the fields these formularies. I believe that it will to attend the many of which aren't PHP coders.

 

Despite this, I emphasize that this is only a beta release. Our commentaries areas are open to receive reports of how the 2.0b JCCreCaptcha is working on real world and certainly, these situations will be on our future development list.

 

 

About the Author

 

Júlio Oliveira
Júlio Oliveira is System Analyst with lato-sensu degree in Software Project Management by PUC/Rio. He have experience of 20 years in enterprise software development, of which 10 years, working on national and international insurance companies, currently, he is TI consultant and website developer.

 

 



Adicionar este artigo ao seu site de favoritos ?
Digg! Reddit! Del.icio.us! Google! Live! Facebook! Technorati! StumbleUpon! MySpace! Netvouz! Mister-Wong! Diigo! Faves! Ask! DZone! Swik! Twitter! LinkedIn!

Comments (8)
8 Tuesday, 05 January 2010 23:40
Brian
I hope I am not double sending...

I just went through the entire setup and configuration.
I am running Joomla 1.5.15

I installed:
JCCreCaptcha 2.0b
JCCreCaptcha 2.01b
plg_JCCreCaptchaCV.zip

I got it running and working on the correct page/form.

What I am finding out in testing the reCAPTCHA security module is that it does not work correctly.

I am hoping it is something I am missing.

Example:

The captcha asks for:

LESSON NUCLEAR

I type:

lessog nuc

It accepts it!

This is the case every time. It appears the first word has to have at least the first 4 characters correct.

The second word is random and appears to need only the correct amount of characters for about the first three.

The second word does not even need the correct characters.

Any suggestions?

Thanks,
Brian
7 Sunday, 13 December 2009 21:11
ahmad
hello Julio..

i really cant get this to work.. i downloaded the update to this one and here is what i did:

1. installed the module and plugin. done.
2. activated the module.. and typed this in restore field "name;username;email;password;password2;" and password2 in "form item ID".
3. activated the plugin..
4. filled up the keys for recaptura.. the blocked tasks by typing "com_user,register_save" without "".. but it doesnt work and nothing appairs on my registration page?

can you pleas help me out? i also tried the way like in old version by doing it self, but still doesnt work.. hope you can help me..

regards
peter
6 Wednesday, 02 December 2009 05:16
Brad
Hi Julio

Sorry mate I'm not having as much ease in making this work like everyone else is.

I've downloaded and installed 2.0b.

The page I'm trying to add the recaptcha to is this one:

http://primalmovement.com.au/jcms/contact-us.html

I want the captcha to exist after the 'enter your message' text box.

I'm not sure if you have written the english or an Alta Vista program has done it but it's a bit hard to understand sorry. What do you mean by 'formulary'? Do you mean 'code'?

I'm currently up to this:

"4. Configure the formulary's fields that have to be persisted:"

Can you tell from my Joomla code what I now have to do?

Thanks for your help in advance

Brad


*** Admin Answer 12/02/2009 - 06:20am - Rio de Janeiro ***

Hi Brad,

By "formulary" I refer to the HTML form user interface on wich the reCaptcha will be injected.

To put the reCaptcha after the 'enter message' text box, you have to see the ID (the ID attribute of the HTML tag that define the text box) of its text box and put it on "Form Item ID", on JCCreCaptchaPlacer module parameters interface. The article shows how to find the text box's ID, using the Google Chrome browser.

If you prefer write on code, please, view the "JCCreCaptcha Plugin" and "Using JCCreCaptcha with yvComment" articles, that explain how to do it.

Thanks,
5 Monday, 16 November 2009 14:56
Previous Question
Oi Julio--

I have finally found the problem with JCCreCaptchaCV and IE7 - here is the error and the article from Microsoft that may help you find that problem. Unfortunately, since I work for the Government "Upgrade to IE8" is not an answer for us - but apparently the problem occurs because of the placement of the code of your script with the contact form. Hopefully this will help you solve the problem - I am not a programmer, so I don't understand the solution - abraço - Ted
--------------------------------
The error is: "HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)"

Here is the Microsoft article on the problem: http://support.microsoft.com/kb/927917

Feel free to contact me directly if needed to help test: *****@********.***

Eu falo um pouco portugués tb - minha esposa é Paulistana...

abraço

*** Admin Answer - 11/17/2009 06:29pm Rio de Janeiro ***

Great work! Very thanks for the help. I will try to fix it soon and certainly I will to send you the fix, to test.

As you understand portuguese too, abraço para você, sua esposa e família!
Obrigado!
4 Friday, 13 November 2009 08:45
geeth
hi Júlio,

thanks for sharing tools to us, i has been used 1.0 but i couldn't install 2.0 properly please help us to configure for joomla 1.5.15

thanks
geeth

*** Admin Answer ***

Hi Geeth!

If you is receiving the "Error! Could not find a Joomla! XML setup file in the package" message, try the JCCreCaptcha 2.01b release, that have a fix for it.

Thanks!
3 Thursday, 12 November 2009 15:58
Y.Lee
Hello. I was able to install 2.0b but the mod_JCCreCaptchaPlacer gives me this error: Error! Could not find a Joomla! XML setup file in the package.

Please help.
(Thank you).


*** Administrator Answer (at 11/16/2009 - 06:45pm - Rio de Janeiro)***

Hi, Y.Lee!

Try the JCCreCaptcha 2.01b release, that have a fix for it.

Thanks!

*** Administrator Answer ***

Hi, Y.Lee!

Give me your e-mail (I will remove it, before publish). At next saturday I will to send you a test release to fix the problem!

Thanks.
2 Tuesday, 10 November 2009 12:25
Shishir Singh
JCCreCaptch do not work when the core SEF is enabled. Is this is so, if not what could have went wrong as it was working previous to that. Please Help

*** Administrator Answer ***

Great Tip, Mr Singh! I will try it!

Thanks!
1 Monday, 09 November 2009 16:14
TedP
Julio - is there a way to use this with the Joomla core contact form without setting it up for every individual contact (like JCCreCaptchaCV does?) I tried using 2.0b and JCCreCaptchaCV together - and it obviously does not work. Is there some simple way with 2.0b to integrate it with all contacts? Otherwise, I have to set up a module for every single contact so it knows where to place it on the page?

*** Administrator Answer ***

Hi TedP,

Do you solved the previous question ?

About the present question, (if I understanded):

- The 2.0b release is a more comprehensive tool, but it isn't specific for Contacts, like JCCreCaptchaCV;

- Yes, JCCreCaptchaCV don't work with 2.0b release;

- If your contacts have a menu option for each one, you can use only one JCCreCaptchaPlacer, since you can set a module for more than one menu.

I hope I have helped.

Thanks,

Add your comment

Your name:
Comment:

Menu Principal

Editar traduo para English (United Kingdom) Editar traduo para Português (Brasil)
Blog Sistemas e Cia