Captcha is Evil! Solution for JoomShopping, Virtuemart and com_contact

Captcha is Evil! Solution for JoomShopping, Virtuemart and com_contact

Everyone knows, the lesser fields are required to fill during the registration process the higher conversion is. But what to do with bots which have been signing up on our site? To add Captcha? It’s a paradox. Below you will find a simple yet nice solution allowing you to prevent bots' submissions without Captcha.

What bots are doing? They’re submitting registration form. And what site developers are doing to prevent the registration on direct link? They adds so called token field with random name to the field. The solution: during page rendering on client side we must display the form without token field (without our random name). But after full page loading (to this moment the bot ate the page) we create a token field in the form using special script. Or, it’s better to say, not create, but assign a correct random value to the script.

Solution for JoomShopping ver.4.15.0

Edit registration layout page at: /components/com_jshopping/templates/default/user/register.php (this is default template, if you’re using custom JoomShopping template or override the template - go to Joomla template and edit this override of the file)

Find and remove the following line in the end of file:


echo JHtml::_( 'form.token' );

Then add the following script in the end of file:


<script type="text/javascript">    
    jQuery(document).ready(function() {
    jQuery("form.form-validate").append('<?php echo JHtml::_( 'form.token' ); ?>');
 });
</script>

Save and enjoy the result.

Solution for Virtuemart ver. 3.0.18

Edit registration layout page file in Virtuemart template: /components/com_virtuemart/views/user/tmpl/edit.php (this is default template, if you’re using custom template - go to Joomla template and edit this override of the file)

Find and remove the following line in the end of file:


echo JHtml::_( 'form.token' );

Then add the following script in the end of file:


<script type="text/javascript">    
    jQuery(document).ready(function() {
    jQuery("form.form-validate").append('<?php echo JHtml::_( 'form.token' ); ?>');
 });
</script> 
Save and enjoy the result.

Solution for com_contact (standard contact form)

Edit contact page layout: /components/com_contact/views/contact/tmpl/default_form.php (this is default template, if you’re using custom template - go to Joomla template and edit this override of the file) Find and remove the following line in the end of file:

echo JHtml::_( 'form.token' );
Then add the following script in the end of file:

<script type="text/javascript">    
    var parentElem = document.getElementById('contact-form');
    var elem = document.createElement("div");
    elem.innerHTML= ('<?php echo JHtml::_( 'form.token' ); ?>');
    parentElem.appendChild(elem);
</script> 

Save and enjoy the result.

Original article in Russian

Google+
LinkedIn
Pinterest

Eugene Sivokon

About author

Eugene has been a part of and worked in many of the web development roles over the years, taking on various projects. At the present moment, he is involved as a team manager working inside his personal projects. This blog is specifically dedicated to start-up businesses, team management, and how to maximize your success with Open Source ideology.

Norrnext - extensions for Joomla and Pagekit

RoundTheme - Professional Kunena templates

NorrTheme - templates for Joomla and Wordpress