A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Hot answers tagged

35

You need follow some step for using magento captcha into custom module. Step 1 : Vendor/Module/etc/config.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> <customer> <captcha> ...


15

Created a new module for this. Step 1: app/code/local/Contact/Captcha/etc/config.xml <?xml version="1.0"?> <config> <modules> <Contact_Captcha> <version>0.1.0</version> </Contact_Captcha> </modules> <default> <captcha> <frontend> <areas> ...


11

The way you did answer above is not a good approach. The class Zend_Captcha_Image has provided functions to change the variables. You can find the functions in the same class which will be something like this: public function setDotNoiseLevel ($dotNoiseLevel) { $this->_dotNoiseLevel = $dotNoiseLevel; return $this; } /** * @param int $...


10

Sadly the RWD theme has been implemented without captcha. See notes from the design guide section Exceptions to Responsive Web Design. They have managed this by providing an empty layout.xml file for the captcha module under app/design/frontend/rwd/default/layout/captcha.xml. What you could try is to disable this file and so it will fall back to the default ...


9

You should try this code: I have been using this on my site. <script> window.onload = function() { var recaptcha = document.forms["contactForm"]["g-recaptcha-response"]; recaptcha.required = true; recaptcha.oninvalid = function(e) { alert("Please complete the captcha"); } } </script>


8

You can change the captcha noise using below code. Go to : lib/Zend/Captcha/Image.php Change below variable values as per your requirements protected $_dotNoiseLevel = 10; // Increase the value if you want to increase amount of dots protected $_lineNoiseLevel = 0; // Increase the value if you want to increase amount of lines Reference : http://...


7

Given that the custom extension does not extend Mage_Captcha and instead uses their own implementation, you can disable the core module entirely. Create a file app/etc/modules/Zzz_Deactivate.xml with the following content: <?xml version="1.0"?> <config> <modules> <Mage_Captcha> <active>false</active> </...


7

This script use for validation google reCaptcha like a default validation of magento. please use it. <form name="freeeventForm" id="freeeventForm"> <div id="RecaptchaField"></div> <input type="hidden" class="validate-reCAPTCHA"> </form> <script src="https://www.google.com/recaptcha/api.js?onload=...


7

I was facing the same issue before and in my case it was caused by my theme's customer_account_login.xml file. For example, if your theme is extending Magento_Blank theme, then you don't need to copy the entire contents of the customer_account_login.xml file to your theme to make changes to it --> this will "bug out" the CAPTCHA form. The proper way to ...


6

It is not so complicated. First in composer.json file add this line in psr-0 node "Zend_Captcha": "app/code/" so it will look like that "psr-0": { "": "app/code/", "Zend_Captcha": "app/code/" }, Then create directory app/code/Zend/Captcha/ and place there your file Image.php that you want to override. After that just run composer update.


6

Sadly the RWD theme has been implemented without captcha. So you can customize theme. Follow these steps: Go Base theme/layout folder and copy the captcha.xml file code in your theme directory/layout/captcha.xml file in layout folder. Go Base theme/template and copy the captcha directory and paste in your theme/template folder. Thus, your captcha code will ...


6

I used recaptcha in contact form.. <form action="<?php echo Mage::getUrl('mcrecaptcha/index/save'); ?>" id="contactForm" method="post" onSubmit="return checkcaptcha() ;"> <ul class="form-list"> <li class="fields"> <div class="field"> <div class="input-box"> ...


6

I had the same problem and solved it as follows. Go with phpmyadmin to the database table customer_eav_attribute and edit the record 5 (attribute_id 5). Edit content table column validate_rules -> max_text_length "; i: 255" to "-> max_text_length"; i: 65. attribute_id 5 is the first name and the values in the validate_rules are checked before the ...


5

The accepted JavaScript solution above is definitely NOT the way to go in my opinion. Any bot that's not using JS (which is most of them) will simply bypass your validation and you'll get all that spam you're trying to block. Always always always validate on the server. JS validation is just a UX first step. Anyway, there are multiple solutions, but here's ...


5

Have a look at this answer Magento: Add captcha to custom contact form NameSpace : MyPackage and Module: MyModule Module configuration location : app/etc/modules/MyPackage_MyModule.xml <config> <modules> <MyPackage_MyModule> <active>true</active> <codePool>local</codePool> </...


4

There is a possibility to enable CAPTCHA for the Admin Panel in System > Configuration > Advanced > Admin > CAPTCHA and if you have enabled it (by accident) this could be a cache issue. So try the following. Flush all Magento Cache before logging in (including your browsers cache); or Try another browser to login To manually delete all chache ...


4

Edit this file: /app/code/core/Mage/Captcha/Model/Zend.php add this code after line 87 $this->setDotNoiseLevel(10); // Added code $this->setLineNoiseLevel(0); // Added code This overrides the lib/Zend/Captcha/Image.php file, which if you edit it, resets to default values ... Apaarently, the 1.7CE answer works for 1.9.1CE, just slightly ...


4

It's long answer though. Step 1. Vendor/Module/etc/config.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> <customer> <captcha> <shown_to_logged_in_user&...


4

I found fix for development environment, because I use Mac OS and the apache php doesn't support these fonts and it's a lot of work to get it working and not mess up my system. open vendor/zendframework/zend-captcha/src/Image.php and add return in the constructor after the parent is called like this /** * Constructor * * @param array|\Traversable $...


4

There is no need to call <p>{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}</p> in the content tab. If you don't have any other content to show in the content tab, then you can use &nbsp; in the Content tab. Steps to show captcha in contact form in CMS page are listed below: ...


3

My issue is the backend 'web page isn't available'. So it's better to do by following steps: 1) disable Captcha firstly mysql> select * from core_config_data where path like '%captcha%'; mysql> update core_config_data set value=0 where path = 'admin/captcha/enable'; 2) use another browser to login backend My Chrome can't use, so i use firefox to ...


3

If you take a look at app/code/core/Mage/Captcha/etc/config.xml you'll find: <captcha translate="label"> <fonts> <linlibertine> <label>LinLibertine</label> <path>lib/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf</path> </linlibertine> &...


3

For Magento 2 : Go to vendor\magento\zendframework1\library\Zend\Captcha\Image.php You will find below functions in this file which can be used to customize captcha image. /** * Set dot noise level * * @param int $dotNoiseLevel * @return Zend_Captcha_Image */ public function setDotNoiseLevel ($dotNoiseLevel) { ...


3

After you configure form for registration the default registration form will be updated with new fields. The preview for the form will be disabled and "Web-form is not available for direct access." will be shown instead - it is done to prevent non-registration submissions. Configuration parameters Enable Enables customization of the default ...


3

One solution to this problem would be to add a Recaptcha to your registration, and ensuring that it is validated before the account is created. See this link (https://www.google.com/recaptcha/intro/index.html) about setting up Recaptcha. As to why spammers are doing this specifically, I'm afraid that no one can tell you that definitively. However, here are ...


3

Color & Background Magento builds its Model Captcha which extends from Zend_Captcha_Image class. So, in your case, we should override Magento\Captcha\Model\DefaultModel class. <preference for="Magento\Captcha\Model\DefaultModel" type="Vendor\Module\Model\DefaultModel"/> We need to override _generateImage method. protected function ...


3

To validate captcha, create a save controller for saving your form values and also the validation. namespace Mike\SampleModule\Controller; class Save extends \Magento\Framework\App\Action\Action { /** * @var Google reCaptcha Options */ private static $_siteVerifyUrl = "https://www.google.com/recaptcha/api/siteverify?"; private $_secret; private static $...


3

you need to change the php configure script to include --with-freetype-dir=/usr/lib64/ where /usr/lib64 contains the libfreetype.so file. My final configuration so far looks like: ./configure --with-apxs2=/usr/bin/apxs --enable-bcmath --with-curl --with-gd \ --with-jpeg-dir=/usr/lib64/ --with-png-dir=/usr/lib64/ --with-freetype-dir=/usr/lib64/ \ --enable-...


3

You need to either create a custom module or install an extension for this. Below is the code for implementation as a custom module: app/etc/modules/Mohit_Contactcaptcha.xml <?xml version="1.0"?> <config> <modules> <Mohit_Contactcaptcha> <active>true</active> <codePool>local&...


3

To Enable/Disable Captcha From Customer Password Forms: Go to Admin->Stores->Customers->Customer Configuration->CAPCTHA->Forms To Enable/Disable Captcha From Admin Password Forms: Go to Admin->Stores->Advanced->Admin->CAPCTHA->Forms Here you can select/unselect forms


Only top voted, non community-wiki answers of a minimum length are eligible