PHP Magento Tips

Add Google reCAPTCHA in Customer Account Login, Account Register, Forgot password and Billing Page in Magento

Rate this posting:
{[['']]}

Before Starting of this tutorial you need to have your Google reCAPTCHA Site key and Secret key.

With this module you can select From below page on which you want to display google reCAPTCHA.

  • Customer Register Form Page
  • Customer Login Form Page
  • Customer Forgot Password Form Page
  • Checkout Billing Form Page

Step1: Create Module Configuration file. Create file in app/etc/modules/Mycompany_Customerrecaptcha.xml and add below code in it.

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Mycompany_Customerrecaptcha>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Customer/>
            </depends>
        </Mycompany_Customerrecaptcha>
    </modules>
</config>

Step 2: Create Module Config and system.xml file.
a:) Create file in app/code/local/Mycompany/Customerrecaptcha/etc/config.xml and add below code in it.

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Mycompany_Customerrecaptcha>
            <version>1.0.0</version>
        </Mycompany_Customerrecaptcha>
    </modules>

    <global>
        <blocks>
            <customer>
                <rewrite>
                    <form_register>Mycompany_Customerrecaptcha_Block_Form_Register</form_register>
                    <form_login>Mycompany_Customerrecaptcha_Block_Form_Login</form_login>                                        <account_forgotpassword>Mycompany_Customerrecaptcha_Block_Account_Forgotpassword</account_forgotpassword>
                </rewrite>
            </customer>
            <checkout>
                <rewrite>
                    <onepage_login>Mycompany_Customerrecaptcha_Block_Onepage_Login</onepage_login>   
                    <onepage_billing>Mycompany_Customerrecaptcha_Block_Onepage_Billing</onepage_billing>                   
                </rewrite>
            </checkout>
        </blocks>
        <helpers>
            <mycompany_customerrecaptcha>
                <class>Mycompany_Customerrecaptcha_Helper</class>
            </mycompany_customerrecaptcha>
        </helpers>
        <models>
            <mycompany_customerrecaptcha>
                <class>Mycompany_Customerrecaptcha_Model</class>
            </mycompany_customerrecaptcha>
        </models>
    </global>

    <frontend>
        <routers>
            <customer>
                <args>
                    <modules>
                        <mycompany_customerrecaptcha before="Mage_Customer">Mycompany_Customerrecaptcha</mycompany_customerrecaptcha>
                    </modules>
                </args>
            </customer>
            <checkout>
                <args>
                    <modules>
                        <mycompany_customerrecaptcha before="Mage_Checkout">Mycompany_Customerrecaptcha</mycompany_customerrecaptcha>
                    </modules>
                </args>
            </checkout>
        </routers>
        <layout>
             <updates>
                <mycompany_customerrecaptcha>
                    <file>customerrecaptcha.xml</file>                
                </mycompany_customerrecaptcha>                
            </updates>
        </layout>
    </frontend>
</config>
B:) Create file in app/code/local/Mycompany/Customerrecaptcha/etc/system.xml and add below code in it.

<?xml version="1.0"?>
<config>
    <sections>
        <customer>
            <groups>
                <Mycompany_Customerrecaptcha translate="label" module="mycompany_customerrecaptcha">
                    <label>Customer Account reCAPTCHA</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>120</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <customerrecaptcha_enabled translate="label">
                            <label>Enable reCAPTCHA:</label>
                            <comment>'Yes' to enable the Recaptcha Extension, 'No' to disable the Recaptcha Extension.</comment>
                            <frontend_type>select</frontend_type>
                            <sort_order>10</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                        </customerrecaptcha_enabled>    
                        <customerrecaptcha_public_key translate="label">
                            <label>Site Key (Public Key)</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>20</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <depends><customerrecaptcha_enabled>1</customerrecaptcha_enabled></depends>
                        </customerrecaptcha_public_key>
                        <customerrecaptcha_private_key translate="label">
                            <label>Secret Key (Private Key)</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>30</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <depends><customerrecaptcha_enabled>1</customerrecaptcha_enabled></depends>
                        </customerrecaptcha_private_key>    
                        <customerrecaptcha_theme translate="label">
                            <label>Recaptcha Theme</label>
                            <frontend_type>select</frontend_type>
                            <source_model>mycompany_customerrecaptcha/system_config_source_dropdown_theme</source_model>
                            <sort_order>40</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <depends><customerrecaptcha_enabled>1</customerrecaptcha_enabled></depends>
                        </customerrecaptcha_theme>
                        <customerrecaptcha_language translate="label">
                            <label>Language</label>
                            <frontend_type>select</frontend_type>
                            <source_model>mycompany_customerrecaptcha/system_config_source_dropdown_lang</source_model>
                            <sort_order>50</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <depends><customerrecaptcha_enabled>1</customerrecaptcha_enabled></depends>
                        </customerrecaptcha_language>                
                    </fields>
                </Mycompany_Customerrecaptcha>
                <Customerrecaptcha_Forms translate="label">
                    <label>Customer Account reCAPTCHA Forms</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>130</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>0</show_in_website>
                    <show_in_store>0</show_in_store>
                    <fields>                        
                        <customerrecaptcha_register translate="label">
                            <label>Customer Register Form: </label>
                            <comment>'Yes' to enable Register form Recaptcha.</comment>
                            <frontend_type>select</frontend_type>                            
                            <sort_order>20</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                         </customerrecaptcha_register>
                         <customerrecaptcha_login translate="label">
                            <label>Customer Login Form: </label>
                            <comment>'Yes' to enable Login form Recaptcha.</comment>
                            <frontend_type>select</frontend_type>                            
                            <sort_order>30</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                         </customerrecaptcha_login>
                         <customerrecaptcha_forgotpwd translate="label">
                            <label>Customer Forgot Password Form: </label>
                            <comment>'Yes' to enable Forgot Password form Recaptcha.</comment>
                            <frontend_type>select</frontend_type>                            
                            <sort_order>40</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                         </customerrecaptcha_forgotpwd>
                         <customerrecaptcha_billing translate="label">
                            <label>Checkout Billing Form: </label>
                            <comment>'Yes' to enable Checkout Billing Form Recaptcha.</comment>
                            <frontend_type>select</frontend_type>                            
                            <sort_order>50</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                         </customerrecaptcha_billing>
                    </fields>
                </Customerrecaptcha_Forms>
            </groups>
        </customer>
    </sections>
</config>

Step 3: Create Module Helper file. Create file in app/code/local/Mycompany/Customerrecaptcha/Helper/Data.php and add below code in it.

<?php
class Mycompany_Customerrecaptcha_Helper_Data extends Mage_Core_Helper_Abstract
{
}

Step 4: Create Block Files to Pass necessary data for reCAPTCHA.

A:) Create file in app/code/local/Mycompany/Customerrecaptcha/Block/Form/Login.php and add below code in it for Customer Login Page reCAPTCHA.

<?php

class Mycompany_Customerrecaptcha_Block_Form_Login extends Mage_Customer_Block_Form_Login
{
    const XML_PATH_CRC_ENABLED     = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled';
    const XML_PATH_CRCLOGIN_FRM     = 'customer/Customerrecaptcha_Forms/customerrecaptcha_login';
    const XML_PATH_CRC_PUBLIC_KEY  = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_public_key';
    const XML_PATH_CRC_PRIVATE_KEY = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_private_key';
    const XML_PATH_CRC_THEME       = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_theme';
    const XML_PATH_CRC_LANG        = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_language';
    

    /**
     * Retrieve reCAPTCHA site key
     *
     * @return string
     */
    public function getSitekey()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCLOGIN_FRM))) {
            //get site key
            $siteKey = Mage::getStoreConfig(self::XML_PATH_CRC_PUBLIC_KEY);
        }       
        return $siteKey;
    }
    
    /**
     * Retrieve reCAPTCHA theme
     *
     * @return string
     */
    public function getTheme()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCLOGIN_FRM))) {
            //get reCaptcha theme name
            $theme = Mage::getStoreConfig(self::XML_PATH_CRC_THEME);
            if (strlen($theme) == 0 || !in_array($theme, array('dark', 'light'))) {
                        $theme = 'light';
            }
        }
        return $theme;
    }
    
    /**
     * Retrieve reCAPTCHA lang
     *
     * @return string
     */
    public function getLang()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCLOGIN_FRM))) {
            //get reCaptcha lang name
            $lang = Mage::getStoreConfig(self::XML_PATH_CRC_LANG);
            if (strlen($lang) == 0) {
                $lang = 'en';
            }
        }
        return $lang;
    }
}

B:) Create file in app/code/local/Mycompany/Customerrecaptcha/Block/Form/Register.php and add below code in it for Customer Register Page reCAPTCHA.

<?php

class Mycompany_Customerrecaptcha_Block_Form_Register extends Mage_Customer_Block_Form_Register
{
    const XML_PATH_CRC_ENABLED     = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled';
    const XML_PATH_CRCREG_FRM     = 'customer/Customerrecaptcha_Forms/customerrecaptcha_register';
    const XML_PATH_CRC_PUBLIC_KEY  = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_public_key';
    const XML_PATH_CRC_PRIVATE_KEY = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_private_key';
    const XML_PATH_CRC_THEME       = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_theme';
    const XML_PATH_CRC_LANG        = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_language';
    
    /**
     * Retrieve form data
     *
     * @return Varien_Object
     */
    public function getFormData()
    {
        $data = $this->getData('form_data');
        if (is_null($data)) {
            $formData = Mage::getSingleton('customer/session')->getCustomerFormData(true);
            $data = new Varien_Object();
            if ($formData) {
                $data->addData($formData);
                $data->setCustomerData(1);
            }
            if (isset($data['region_id'])) {
                $data['region_id'] = (int)$data['region_id'];
            }
            //if "Customer reCAPTCHA" module is enabled - then we add additional data in array
            if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCREG_FRM))) {
                //get site key     
                $siteKey = Mage::getStoreConfig(self::XML_PATH_CRC_PUBLIC_KEY);
                $data['public_key'] = $siteKey;
                //get reCaptcha theme name
                $theme = Mage::getStoreConfig(self::XML_PATH_CRC_THEME);
                if (strlen($theme) == 0 || !in_array($theme, array('dark', 'light'))) {
                    $theme = 'light';
                }
                $data['theme'] = $theme;
                //get reCaptcha lang name
                $lang = Mage::getStoreConfig(self::XML_PATH_CRC_LANG);
                if (strlen($lang) == 0) {
                    $lang = 'en';
                }
                $data['lang'] = $lang;
            }
            $this->setData('form_data', $data);
        }
        return $data;
    }
}

C:) Create file in app/code/local/Mycompany/Customerrecaptcha/Block/Onepage/Login.php and add below code in it for Checkout Login Page reCAPTCHA.

<?php

class Mycompany_Customerrecaptcha_Block_Onepage_Login extends Mage_Checkout_Block_Onepage_Login
{
    const XML_PATH_CRC_ENABLED     = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled';
    const XML_PATH_CRCLOGIN_FRM     = 'customer/Customerrecaptcha_Forms/customerrecaptcha_login';
    const XML_PATH_CRC_PUBLIC_KEY  = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_public_key';
    const XML_PATH_CRC_PRIVATE_KEY = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_private_key';
    const XML_PATH_CRC_THEME       = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_theme';
    const XML_PATH_CRC_LANG        = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_language';
    

    /**
     * Retrieve reCAPTCHA site key
     *
     * @return string
     */
    public function getSitekey()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCLOGIN_FRM))) {
            //get site key
            $siteKey = Mage::getStoreConfig(self::XML_PATH_CRC_PUBLIC_KEY);
        }        
        return $siteKey;
    }
    
    /**
     * Retrieve reCAPTCHA theme
     *
     * @return string
     */
    public function getTheme()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCLOGIN_FRM))) {
            //get reCaptcha theme name
            $theme = Mage::getStoreConfig(self::XML_PATH_CRC_THEME);
            if (strlen($theme) == 0 || !in_array($theme, array('dark', 'light'))) {
                        $theme = 'light';
            }
        }
        return $theme;
    }
    
    /**
     * Retrieve reCAPTCHA lang
     *
     * @return string
     */
    public function getLang()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCLOGIN_FRM))) {
            //get reCaptcha lang name
            $lang = Mage::getStoreConfig(self::XML_PATH_CRC_LANG);
            if (strlen($lang) == 0) {
                $lang = 'en';
            }
        }
        return $lang;
    }
}

D:) Create file in app/code/local/Mycompany/Customerrecaptcha/Block/Onepage/Billing.php and add below code in it for for Checkout Billing Page reCAPTCHA.

<?php

class Mycompany_Customerrecaptcha_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing
{
    const XML_PATH_CRC_ENABLED     = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled';
    const XML_PATH_OPCBILLREG_ENABLED     = 'customer/Customerrecaptcha_Forms/customerrecaptcha_billing';
    const XML_PATH_CRC_PUBLIC_KEY  = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_public_key';
    const XML_PATH_CRC_PRIVATE_KEY = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_private_key';
    const XML_PATH_CRC_THEME       = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_theme';
    const XML_PATH_CRC_LANG        = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_language';
    

    /**
     * Retrieve reCAPTCHA site key
     *
     * @return string
     */
    public function getSitekey()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_OPCBILLREG_ENABLED))) {
            //get site key
            $siteKey = Mage::getStoreConfig(self::XML_PATH_CRC_PUBLIC_KEY);
        }        
        return $siteKey;
    }
    
    /**
     * Retrieve reCAPTCHA theme
     *
     * @return string
     */
    public function getTheme()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_OPCBILLREG_ENABLED))) {
            //get reCaptcha theme name
            $theme = Mage::getStoreConfig(self::XML_PATH_CRC_THEME);
            if (strlen($theme) == 0 || !in_array($theme, array('dark', 'light'))) {
                        $theme = 'light';
            }
        }
        return $theme;
    }
    
    /**
     * Retrieve reCAPTCHA lang
     *
     * @return string
     */
    public function getLang()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_OPCBILLREG_ENABLED))) {
            //get reCaptcha lang name
            $lang = Mage::getStoreConfig(self::XML_PATH_CRC_LANG);
            if (strlen($lang) == 0) {
                $lang = 'en';
            }
        }
        return $lang;
    }
}

 E:) Create file in app/code/local/Mycompany/Customerrecaptcha/Block/Account/Forgotpassword.php and add below code in it for Forgot Password Page reCAPTCHA.

<?php

class Mycompany_Customerrecaptcha_Block_Account_Forgotpassword extends Mage_Customer_Block_Account_Forgotpassword
{
    const XML_PATH_CRC_ENABLED     = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled';
    const XML_PATH_CRCFRG_FRM     = 'customer/Customerrecaptcha_Forms/customerrecaptcha_forgotpwd';
    const XML_PATH_CRC_PUBLIC_KEY  = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_public_key';
    const XML_PATH_CRC_PRIVATE_KEY = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_private_key';
    const XML_PATH_CRC_THEME       = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_theme';
    const XML_PATH_CRC_LANG        = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_language';
    
    
    /**
     * Retrieve reCAPTCHA site key
     *
     * @return string
     */
    public function getSitekey()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCFRG_FRM))) {
            //get site key
            $siteKey = Mage::getStoreConfig(self::XML_PATH_CRC_PUBLIC_KEY);
        }
        return $siteKey;
    }
    
    /**
     * Retrieve reCAPTCHA theme
     *
     * @return string
     */
    public function getTheme()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCFRG_FRM))) {
            //get reCaptcha theme name
            $theme = Mage::getStoreConfig(self::XML_PATH_CRC_THEME);
            if (strlen($theme) == 0 || !in_array($theme, array('dark', 'light'))) {
                $theme = 'light';
            }
        }
        return $theme;
    }
    
    /**
     * Retrieve reCAPTCHA lang
     *
     * @return string
     */
    public function getLang()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCFRG_FRM))) {
            //get reCaptcha lang name
            $lang = Mage::getStoreConfig(self::XML_PATH_CRC_LANG);
            if (strlen($lang) == 0) {
                $lang = 'en';
            }
        }
        return $lang;
    }

}

Step 5: Create Model files to give Selection of Theme and Language for reCAPTCHA.
a:) Create file in app/code/local/Mycompany/Customerrecaptcha/Model/System/Config/Source/Dropdown/Lang.php and add below code in it.

<?php
class Mycompany_Customerrecaptcha_Model_System_Config_Source_Dropdown_Lang
{
    /**
     * Generate lang options array
     * @return array
     */
    public function toOptionArray() {
        return array (
                array (
                        'value' => 'en',
                        'label' => 'English (default)'
                ),
                array (
                        'value' => 'ar',
                        'label' => 'Arabic'
                ),
                array (
                        'value' => 'af',
                        'label' => 'Afrikaans'
                ),
                array (
                        'value' => 'am',
                        'label' => 'Amharic'
                ),
                array (
                        'value' => 'hy',
                        'label' => 'Armenian'
                ),
                array (
                        'value' => 'az',
                        'label' => 'Azerbaijani'
                ),
                array (
                        'value' => 'eu',
                        'label' => 'Basque'
                ),
                array (
                        'value' => 'bn',
                        'label' => 'Bengali'
                ),
                array (
                        'value' => 'bg',
                        'label' => 'Bulgarian'
                ),
                array (
                        'value' => 'ca',
                        'label' => 'Catalan'
                ),
                array (
                        'value' => 'zh-HK',
                        'label' => 'Chinese (Hong Kong)'
                ),
                array (
                        'value' => 'zh-CN',
                        'label' => 'Chinese (Simplified)'
                ),
                array (
                        'value' => 'zh-TW',
                        'label' => 'Chinese (Traditional)'
                ),
                array (
                        'value' => 'hr',
                        'label' => 'Croatian'
                ),
                array (
                        'value' => 'cs',
                        'label' => 'Czech'
                ),
                array (
                        'value' => 'da',
                        'label' => 'Danish'
                ),
                array (
                        'value' => 'nl',
                        'label' => 'Dutch'
                ),
                array (
                        'value' => 'en-GB',
                        'label' => 'English (UK)'
                ),
                array(
                        'value' => 'et',
                        'label' => 'Estonian',
                ),
                array(
                        'value' => 'fil',
                        'label' => 'Filipino',
                ),
                array(
                        'value' => 'fi',
                        'label' => 'Finnish',
                ),
                array(
                        'value' => 'fr',
                        'label' => 'French',
                ),
                array(
                        'value' => 'fr-CA',
                        'label' => 'French (Canadian)',
                ),
                array(
                        'value' => 'gl',
                        'label' => 'Galician',
                ),
                array(
                        'value' => 'ka',
                        'label' => 'Georgian',
                ),
                array(
                        'value' => 'de',
                        'label' => 'German',
                ),
                array(
                        'value' => 'de-AT',
                        'label' => 'German (Austria)',
                ),
                array(
                        'value' => 'de-CH',
                        'label' => 'German (Switzerland)',
                ),
                array(
                        'value' => 'el',
                        'label' => 'Greek',
                ),
                array(
                        'value' => 'gu',
                        'label' => 'Gujarati',
                ),
                array(
                        'value' => 'iw',
                        'label' => 'Hebrew',
                ),
                array(
                        'value' => 'hi',
                        'label' => 'Hindi',
                ),
                array(
                        'value' => 'hu',
                        'label' => 'Hungarain',
                ),
                array(
                        'value' => 'is',
                        'label' => 'Icelandic',
                ),
                array(
                        'value' => 'id',
                        'label' => 'Indonesian',
                ),
                array(
                        'value' => 'it',
                        'label' => 'Italian',
                ),
                array(
                        'value' => 'ja',
                        'label' => 'Japanese',
                ),
                array(
                        'value' => 'kn',
                        'label' => 'Kannada',
                ),
                array(
                        'value' => 'ko',
                        'label' => 'Korean',
                ),
                array(
                        'value' => 'lo',
                        'label' => 'Laothian',
                ),
                array(
                        'value' => 'lv',
                        'label' => 'Latvian',
                ),
                array(
                        'value' => 'lt',
                        'label' => 'Lithuanian',
                ),
                array(
                        'value' => 'ms',
                        'label' => 'Malay',
                ),
                array(
                        'value' => 'ml',
                        'label' => 'Malayalam',
                ),
                array(
                        'value' => 'mr',
                        'label' => 'Marathi',
                ),
                array(
                        'value' => 'mn',
                        'label' => 'Mongolian',
                ),
                array(
                        'value' => 'no',
                        'label' => 'Norwegian',
                ),
                array(
                        'value' => 'fa',
                        'label' => 'Persian',
                ),
                array(
                        'value' => 'pl',
                        'label' => 'Polish',
                ),
                array(
                        'value' => 'pt',
                        'label' => 'Portuguese',
                ),
                array(
                        'value' => 'pt-BR',
                        'label' => 'Portuguese (Brazil)',
                ),
                array(
                        'value' => 'pt-PT',
                        'label' => 'Portuguese (Portugal)',
                ),
                array(
                        'value' => 'ro',
                        'label' => 'Romanian',
                ),
                array(
                        'value' => 'ru',
                        'label' => 'Russian',
                ),
                array(
                        'value' => 'sr',
                        'label' => 'Serbian',
                ),
                array(
                        'value' => 'si',
                        'label' => 'Sinhalese',
                ),
                array(
                        'value' => 'sk',
                        'label' => 'Slovak',
                ),
                array(
                        'value' => 'sl',
                        'label' => 'Slovenian',
                ),
                array(
                        'value' => 'es',
                        'label' => 'Spanish',
                ),
                array(
                        'value' => 'es-419',
                        'label' => 'Spanish (Latin America)',
                ),
                array(
                        'value' => 'sw',
                        'label' => 'Swahili',
                ),
                array(
                        'value' => 'sv',
                        'label' => 'Swedish',
                ),
                array(
                        'value' => 'ta',
                        'label' => 'Tamil',
                ),
                array(
                        'value' => 'te',
                        'label' => 'Telugu',
                ),
                array(
                        'value' => 'th',
                        'label' => 'Thai',
                ),
                array(
                        'value' => 'tr',
                        'label' => 'Turkish',
                ),
                array(
                        'value' => 'uk',
                        'label' => 'Ukrainian',
                ),
                array(
                        'value' => 'ur',
                        'label' => 'Urdu',
                ),
                array(
                        'value' => 'vi',
                        'label' => 'Vietnamese',
                ),
                array(
                        'value' => 'zu',
                        'label' => 'Zulu',
                )
        );
    }
}

b:) Create file in app/code/local/Mycompany/Customerrecaptcha/Model/System/Config/Source/Dropdown/Theme.php and add below code in it.

<?php
class Mycompany_Customerrecaptcha_Model_System_Config_Source_Dropdown_Theme
{
    /**
     * Generate theme options array
     * @return array
     */
    public function toOptionArray()
    {
        return array(
            array(
                'value' => 'light',
                'label' => 'Light (default)',
            ),
            array(
                'value' => 'dark',
                'label' => 'Dark',
            )
        );
    }
}

Step 6: Create controllers to override default action and called our own action.

A:) Create file in app/code/local/Mycompany/Customerrecaptcha/controllers/AccountController.php and add below code in it.

<?php
//include controller to override it
require_once 'Mage/Customer/controllers/AccountController.php';
class Mycompany_Customerrecaptcha_AccountController extends Mage_Customer_AccountController
{
    /**
     * Create customer account action
     */
    const XML_PATH_CRC_ENABLED     = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled';
    const XML_PATH_CRCLOGIN_FRM     = 'customer/Customerrecaptcha_Forms/customerrecaptcha_login';
    const XML_PATH_CRCFRG_FRM     = 'customer/Customerrecaptcha_Forms/customerrecaptcha_forgotpwd';
    const XML_PATH_CRCREG_FRM     = 'customer/Customerrecaptcha_Forms/customerrecaptcha_register';
    const XML_PATH_CRC_PRIVATE_KEY = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_private_key';
    
    public function createPostAction()
    {        
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCREG_FRM))) {
            try {
                $post = $this->getRequest()->getPost();                
                if ($post) {
                    if ((!isset($post['g-recaptcha-response']))
                    || (!$this->_isCaptchaValid($post['g-recaptcha-response']))
                    ) {
                        throw new Exception(
                                $this->__("The reCAPTCHA wasn't entered correctly. Go back and try it again."),
                                1
                        );
                    }                    
                } else {
                    throw new Exception('', 1);
                }
            } catch (Exception $e) {
                if (strlen($e->getMessage()) > 0) {
                    Mage::getSingleton('customer/session')->addError($this->__($e->getMessage()));                    
                }                
                $this->_getSession()->setCustomerFormData($this->getRequest()->getPost());
                $this->_redirect('*/*/create');
                return;
            }
        }
        
        //everything is OK - call parent action
        parent::createPostAction();
    }
    
    /**
     * Login post action
     */
    public function loginPostAction()
    {
        $checkloginpage = $this->getRequest()->getPost();
        if ($checkloginpage['context']){
            $checkpage = ($checkloginpage['context'] == 'checkout') ? 'checkoutlogin' : '';
        } else {
            $checkpage = 'customerlogin';
        }
        
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCLOGIN_FRM))) {
            try {
                $login = $this->getRequest()->getPost();                
                $loginformData = new Varien_Object();
                $loginformData->setData($login);
                Mage::getSingleton('core/session')->setData('loginForm', $loginformData);
                if ($login) {
                    if ((!isset($login['g-recaptcha-response']))
                    || (!$this->_isCaptchaValid($login['g-recaptcha-response']))
                    ) {
                        throw new Exception(
                                $this->__("The reCAPTCHA wasn't entered correctly. Go back and try it again."),
                                1
                        );
                    }
                    Mage::getSingleton('core/session')->unsetData('loginForm');
                } else {
                    throw new Exception('', 1);
                }
            } catch (Exception $e) {
                if (strlen($e->getMessage()) > 0) {
                    Mage::getSingleton('customer/session')->addError($this->__($e->getMessage()));
                }            
                if ($checkpage == 'customerlogin'){
                    $this->_redirect('*/*/');
                } else {
                    $this->_redirect('checkout/onepage/index');
                }                
                return;
            }
        }
        
        //everything is OK - call parent action
        parent::loginPostAction();
    }
    
    /**
     * Forgot customer password action
     */
    public function forgotPasswordPostAction()
    {
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_CRCFRG_FRM))) {
            try {
                $frgtpwd = $this->getRequest()->getPost();
                $frgtpwdData = new Varien_Object();
                $frgtpwdData->setData($frgtpwd);
                Mage::getSingleton('core/session')->setData('frgtpwdForm', $frgtpwdData);
                if ($frgtpwd) {
                    if ((!isset($frgtpwd['g-recaptcha-response']))
                    || (!$this->_isCaptchaValid($frgtpwd['g-recaptcha-response']))
                    ) {
                        throw new Exception(
                                $this->__("The reCAPTCHA wasn't entered correctly. Go back and try it again."),
                                1
                        );
                    }
                    Mage::getSingleton('core/session')->unsetData('frgtpwdForm');
                } else {
                    throw new Exception('', 1);
                }
            } catch (Exception $e) {
                if (strlen($e->getMessage()) > 0) {
                    Mage::getSingleton('customer/session')->addError($this->__($e->getMessage()));
                }
                $this->_redirect('*/*/forgotPassword');
                return;
            }
        }
        //everything is OK - call parent action
        parent::forgotPasswordPostAction();
    }
    /**
     * Check if captcha is valid
     * @param  string $captchaResponse
     * @return boolean
     */
    protected function _isCaptchaValid($captchaResponse)
    {
        $result = false;
    
        $params = array(
                'secret' => Mage::getStoreConfig(self::XML_PATH_CRC_PRIVATE_KEY),
                'response' => $captchaResponse
        );
    
        $ch = curl_init('https://www.google.com/recaptcha/api/siteverify');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        $requestResult = trim(curl_exec($ch));
        curl_close($ch);
    
        if (is_array(json_decode($requestResult, true))) {
            $response = json_decode($requestResult, true);
    
            if (isset($response['success']) && $response['success'] === true) {
                $result = true;
            }
        }
    
        return $result;
    }
}

B:) Create file in app/code/local/Mycompany/Customerrecaptcha/controllers/OnepageController.php and add below code in it.

<?php
//include controller to override it
require_once 'Mage/Checkout/controllers/OnepageController.php';
class Mycompany_Customerrecaptcha_OnepageController extends Mage_Checkout_OnepageController
{
    const XML_PATH_CRC_ENABLED     = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled';
    const XML_PATH_OPCBILLREG_ENABLED     = 'customer/Customerrecaptcha_Forms/customerrecaptcha_billing';
    const XML_PATH_CRC_PRIVATE_KEY = 'customer/Mycompany_Customerrecaptcha/customerrecaptcha_private_key';
    /**
     * Save checkout billing address
     */
    public function saveBillingAction()
    {
        $getSession =Mage::getSingleton('core/session')->getMyValue();
        if ((Mage::getStoreConfigFlag(self::XML_PATH_CRC_ENABLED)) && (Mage::getStoreConfigFlag(self::XML_PATH_OPCBILLREG_ENABLED)) && (!$getSession)) {
            try {
                $post = $this->getRequest()->getPost();
                if ($post) {
                    //validate captcha
                    if (!isset($post['g-recaptcha-response']) || !$this->_isreCaptchaValid($post['g-recaptcha-response'])) {
                        throw new Exception();
                    }
                }
                else {
                    throw new Exception('', 1);
                }
            }
            catch (Exception $e) {
                $result['error'] = -1;
                $result['message'] = $this->__("The reCAPTCHA wasn't entered correctly. Go back and try it again.");
                $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
                return;
            }
        }
        //everything is OK - call parent action
        $myValue = 'captchaok';
        Mage::getSingleton('core/session')->setMyValue($myValue);
        parent::saveBillingAction();        
    }
    
    /**
     * Check if captcha is valid
     * @param  string $captchaResponse
     * @return boolean
     */
    protected function _isreCaptchaValid($captchaResponse)
    {
        if ($this->_expireAjax()) {
            return;
        }
        $result = false;
    
        $params = array(
                'secret' => Mage::getStoreConfig(self::XML_PATH_CRC_PRIVATE_KEY),
                'response' => $captchaResponse
        );
    
        $ch = curl_init('https://www.google.com/recaptcha/api/siteverify');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        $requestResult = trim(curl_exec($ch));
        curl_close($ch);
    
        if (is_array(json_decode($requestResult, true))) {
            $response = json_decode($requestResult, true);
    
            if (isset($response['success']) && $response['success'] === true) {
                $result = true;
            }
        }
    
        return $result;
    }
}

Step 7: Create Layout file. Create file in app/design/frontend/rwd/default/layout/customerrecaptcha.xml and add below code in it.

<?xml version="1.0"?>
<layout version="0.1.0">
    <customer_account_create>
        <reference name="customer_form_register">
            <action method="setTemplate" ifconfig="customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled">
                <template>customerrecaptcha/persistent/customer/form/register.phtml</template>
            </action>
        </reference>
    </customer_account_create>
    <customer_account_login>
        <reference name="customer_form_login">
            <action method="setTemplate" ifconfig="customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled">
                <template>customerrecaptcha/persistent/customer/form/login.phtml</template>
            </action>
        </reference>
    </customer_account_login>
    <customer_account_forgotpassword>
        <reference name="forgotPassword">
            <action method="setTemplate" ifconfig="customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled">
                <template>customerrecaptcha/customer/form/forgotpassword.phtml</template>
            </action>
        </reference>
     </customer_account_forgotpassword>
    <checkout_onepage_index>
        <reference name="checkout.onepage.login">
            <action method="setTemplate" ifconfig="customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled">
                <template>customerrecaptcha/persistent/checkout/onepage/login.phtml</template>
            </action>
        </reference>
        <reference name="checkout.onepage.billing">
            <action method="setTemplate" ifconfig="customer/Mycompany_Customerrecaptcha/customerrecaptcha_enabled">
                <template>customerrecaptcha/persistent/checkout/onepage/billing.phtml</template>
            </action>
        </reference>        
    </checkout_onepage_index>
</layout>

Step 8: Create template files.

a:) Create file in app/design/frontend/rwd/default/template/customerrecaptcha/persistent/customer/form/login.phtml and add below code in it.

<?php
/**
 * Customer login form template
 *
 * @see app/design/frontend/base/default/template/customer/form/login.phtml
 */
/** @var $this Mage_Customer_Block_Form_Login */
?>
<?php $loginForm = Mage::getSingleton('core/session')->getData('loginForm'); ?>
<?php // $loginForm = $loginForm['login'] ? $loginForm['login'] : new Varien_Object(); ?>
<?php $loginFormusername = ($loginForm['login']['username']) ? $loginForm['login']['username'] : $this->escapeHtml($this->getUsername()) ; ?>
<?php $loginFormpwd = ($loginForm['login']['password']) ? $loginForm['login']['password'] : ''; ?>

<div class="account-login<?php if (!$this->helper('customer')->isRegistrationAllowed()) echo ' login-only' ?>">
    <div class="page-title">
        <h1><?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
                <?php echo $this->__('Login or Create an Account') ?>
            <?php else: ?>
                <?php echo $this->__('Login'); ?>
            <?php endif; ?></h1>
    </div>
    <script src="https://www.google.com/recaptcha/api.js?onload=renderReCaptcha&render=explicit&hl=<?php echo $this->escapeHtml($this->getLang()); ?>" async defer></script>
    <script type="text/javascript">
        function renderReCaptcha() {
            grecaptcha.render('re_captcha', {
              sitekey: '<?php echo $this->escapeHtml($this->getSitekey()); ?>',
              theme: '<?php echo $this->escapeHtml($this->getTheme()); ?>',
              lang: '<?php echo $this->escapeHtml($this->getLang()); ?>'
            });
        }
    </script>
    <?php echo $this->getMessagesBlock()->toHtml() ?>
    <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form" class="scaffold-form">
        <?php echo $this->getBlockHtml('formkey'); ?>
        <div class="col2-set">
            <?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
            <div class="col-1 new-users">
                <div class="content">
                    <h2><?php echo $this->__('New Here?') ?></h2>
                    <p class="form-instructions"><?php echo $this->__('Registration is free and easy!') ?></p>
                    <ul class="benefits">
                        <li><?php echo $this->__('Faster checkout') ?></li>
                        <li><?php echo $this->__('Save multiple shipping addresses') ?></li>
                        <li><?php echo $this->__('View and track orders and more') ?></li>
                    </ul>
                </div>
                <div class="buttons-set">
                    <a title="<?php echo $this->quoteEscape($this->__('Create an Account')) ?>" class="button" href="<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>"><span><span><?php echo $this->__('Create an Account') ?></span></span></a>
                </div>
            </div>
            <?php endif; ?>
            <?php // This column should be col-1 if the registration column is not displayed ?>
            <div class="<?php if ($this->helper('customer')->isRegistrationAllowed()): ?>col-2<?php else: ?>col-1<?php endif; ?> registered-users">
                <div class="content fieldset">
                    <h2><?php echo $this->__('Already registered?') ?></h2>
                    <p class="form-instructions"><?php echo $this->__('If you have an account with us, please log in.') ?></p>
                    <p class="required"><?php echo $this->__('* Required Fields') ?></p>
                    <ul class="form-list">
                        <li>
                            <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                            <div class="input-box">
                                <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="login[username]" value="<?php echo $loginFormusername; ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->quoteEscape($this->__('Email Address')) ?>" />
                            </div>
                        </li>
                        <li>
                            <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
                            <div class="input-box">
                                <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" value="<?php echo $loginFormpwd; ?>" />
                            </div>
                        </li>
                        <?php echo $this->getChildHtml('form.additional.info'); ?>
                        <li>
                            <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
                        </li>
                        <?php echo $this->getChildHtml('persistent.remember.me'); ?>
                        <li class="wide">
                            <div class="input-box">
                                <div id="re_captcha"></div>
                            </div>
                            </li>
                    </ul>
                    <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
                </div>
                <div class="buttons-set">
                    <button type="submit" class="button" title="<?php echo $this->quoteEscape($this->__('Login')) ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
                </div>
            </div>
        </div>
        <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
            <input name="context" type="hidden" value="checkout" />
        <?php endif; ?>
    </form>
    <script type="text/javascript">
    //<![CDATA[
        var dataForm = new VarienForm('login-form', true);
    //]]>
    </script>
</div>

B:) Create file in app/design/frontend/rwd/default/template/customerrecaptcha/persistent/customer/form/register.phtml and add below code in it.

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     rwd_default
 * @copyright   Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Create account form template
 *
 * @see app/design/frontend/base/default/template/customer/form/register.phtml
 */
/** @var $this Mage_Customer_Block_Form_Register */
?>
<div class="account-create">
    <div class="page-title">
        <h1><?php echo $this->__('Create an Account') ?></h1>
    </div>
    <script src="https://www.google.com/recaptcha/api.js?onload=renderReCaptcha&render=explicit&hl=<?php echo $this->getFormData()->getLang(); ?>" async defer></script>
    <script type="text/javascript">
        function renderReCaptcha() {
            grecaptcha.render('re_captcha', {
              sitekey: '<?php echo $this->getFormData()->getPublicKey(); ?>',
              theme: '<?php echo $this->getFormData()->getTheme(); ?>',
              lang: '<?php echo $this->getFormData()->getLang(); ?>'
            });
        }
    </script>
    <?php echo $this->getChildHtml('form_fields_before')?>
    <?php echo $this->getMessagesBlock()->toHtml() ?>
    <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
        <div class="fieldset">
            <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
            <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
            <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
            <p class="form-instructions"><?php echo $this->__('Please enter the following information to create your account.') ?></p>
            <p class="required"><?php echo $this->__('* Required Fields') ?></p>
            <ul class="form-list">
                <li class="fields">
                    <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
                </li>
                <li>
                    <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                    <div class="input-box">
                        <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
                    </div>
                </li>
            <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
            <?php if ($_dob->isEnabled()): ?>
                <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
            <?php endif ?>
            <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
            <?php if ($_taxvat->isEnabled()): ?>
                <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
            <?php endif ?>
            <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
            <?php if ($_gender->isEnabled()): ?>
                <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
            <?php endif ?>

            <?php if($this->getShowAddressFields()): ?>
                <li class="hidden">
                    <input type="hidden" name="create_address" value="1" />
                </li>
                <li class="fields">
                    <div class="field">
                        <label for="company"><?php echo $this->__('Company') ?></label>
                        <div class="input-box">
                            <input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->quoteEscape($this->__('Company')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
                        </div>
                    </div>
                    <div class="field">
                        <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
                        <div class="input-box">
                            <input type="tel" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
                        </div>
                    </div>
                </li>
            <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
                <li class="wide">
                    <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
                    <div class="input-box">
                        <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(0)) ?>" title="<?php echo $this->quoteEscape($this->__('Street Address')) ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
                    </div>
                </li>
            <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
            <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
                <li class="wide">
                    <label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
                    <div class="input-box">
                        <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i - 1)) ?>" title="<?php echo $this->quoteEscape($this->__('Street Address %s', $_i)) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
                    </div>
                </li>
            <?php endfor; ?>
                <li class="fields">
                    <div class="field">
                        <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
                        <div class="input-box">
                            <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->quoteEscape($this->__('City')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
                        </div>
                    </div>
                    <div class="field">
                        <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
                        <div class="input-box">
                            <select id="region_id" name="region_id" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
                                <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
                            </select>
                            <script type="text/javascript">
                            //<![CDATA[
                                $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
                            //]]>
                            </script>
                            <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
                        </div>
                    </div>
                </li>
                <li class="fields">
                    <div class="field">
                        <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
                        <div class="input-box">
                            <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->quoteEscape($this->__('Zip/Postal Code')) ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
                        </div>
                    </div>
                    <div class="field">
                        <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
                        <div class="input-box">
                            <?php echo $this->getCountryHtmlSelect() ?>
                        </div>
                    </div>
                </li>
                <li class="hidden">
                    <input type="hidden" name="default_billing" value="1" />
                    <input type="hidden" name="default_shipping" value="1" />
                </li>
            <?php endif; ?>
                <li class="fields">
                    <div class="field">
                        <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
                        <div class="input-box">
                            <input type="password" name="password" id="password" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" class="input-text required-entry validate-password" />
                        </div>
                    </div>
                    <div class="field">
                        <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
                        <div class="input-box">
                            <input type="password" name="confirmation" title="<?php echo $this->quoteEscape($this->__('Confirm Password')) ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
                        </div>
                    </div>
                </li>
                <?php echo $this->getChildHtml('form.additional.info'); ?>
                <?php if ($this->isNewsletterEnabled()): ?>
                    <li class="control">
                        <div class="input-box">
                            <input type="checkbox" name="is_subscribed" title="<?php echo $this->quoteEscape($this->__('Sign Up for Newsletter')) ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
                        </div>
                        <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
                    </li>
                <?php endif ?>
                <?php echo $this->getChildHtml('persistent.remember.me'); ?>
                <li class="wide">
                    <div class="input-box">
                        <div id="re_captcha"></div>
                    </div>
                    </li>
            </ul>
            <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
        </div>
        <div class="buttons-set">
            <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
            <button type="submit" title="<?php echo $this->quoteEscape($this->__('Register')) ?>" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
        </div>
        <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
            <input name="context" type="hidden" value="checkout" />
        <?php endif; ?>
    </form>
    <script type="text/javascript">
    //<![CDATA[
        var dataForm = new VarienForm('form-validate', true);
        <?php if($this->getShowAddressFields()): ?>
        new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
        <?php endif; ?>
    //]]>
    </script>
</div>

C:) Create file in app/design/frontend/rwd/default/template/customerrecaptcha/persistent/checkout/onepage/login.phtml and add beow code in it.

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     rwd_default
 * @copyright   Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Customer onepage checkout login form template
 *
 * @see app/design/frontend/base/default/template/checkout/onepage/login.phtml
 */
/** @var $this Mage_Checkout_Block_Onepage_Login */
?>
<?php $loginForm = Mage::getSingleton('core/session')->getData('loginForm'); ?>
<?php // $loginForm = $loginForm['login'] ? $loginForm['login'] : new Varien_Object(); ?>
<?php $loginFormusername = ($loginForm['login']['username']) ? $loginForm['login']['username'] : $this->escapeHtml($this->getUsername()) ; ?>
<?php $loginFormpwd = ($loginForm['login']['password']) ? $loginForm['login']['password'] : ''; ?>

<script src="https://www.google.com/recaptcha/api.js?onload=renderReCaptcha&render=explicit&hl=<?php echo $this->escapeHtml($this->getLang()); ?>" async defer></script>
    <script type="text/javascript">
        function renderReCaptcha() {
            grecaptcha.render('re_captcha_login_checkout', {
              sitekey: '<?php echo $this->escapeHtml($this->getSitekey()); ?>',
              theme: '<?php echo $this->escapeHtml($this->getTheme()); ?>',
              lang: '<?php echo $this->escapeHtml($this->getLang()); ?>'
            });
            grecaptcha.render('re_captcha_billing', {
                  sitekey: '<?php echo $this->escapeHtml($this->getSitekey()); ?>',
                  theme: '<?php echo $this->escapeHtml($this->getTheme()); ?>',
                  lang: '<?php echo $this->escapeHtml($this->getLang()); ?>'
                });
        }
    </script>
<?php echo $this->getChildHtml('login_before') ?>
<div class="col2-set<?php if (!$this->helper('customer')->isRegistrationAllowed() && !$this->getQuote()->isAllowedGuestCheckout()) echo ' login-only' ?>">
    <div class="col-1">
        <h3>
            <?php if( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
                <?php echo $this->__('Checkout as a Guest or Register') ?>
            <?php elseif ( $this->getQuote()->isAllowedGuestCheckout() && !$this->helper('customer')->isRegistrationAllowed() ): ?>
                <?php echo $this->__('Checkout as a Guest') ?>
            <?php else: ?>
                <?php echo $this->__('Register to Create an Account') ?>
            <?php endif; ?>
        </h3>
        <?php if( !$this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
            <p class="description"><?php echo $this->__('Register and save time!') ?></strong><br />
                <?php echo $this->__('Register with us for future convenience:') ?></p>
            <ul>
                <li><?php echo $this->__('Fast and easy check out') ?></li>
                <li><?php echo $this->__('Easy access to your order history and status') ?></li>
            </ul>
        <?php elseif( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
            <p class="description"><?php echo $this->__('Register with us for future convenience:') ?></p>
        <?php endif ?>
        <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
            <ul class="form-list">
                <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
                <li class="control">
                    <input type="radio" name="checkout_method" id="login:guest" value="guest"<?php if($this->getQuote()->getCheckoutMethod()!=Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER): ?> checked="checked"<?php endif; ?> class="radio" /><label for="login:guest"><?php echo $this->__('Checkout as Guest') ?></label>
                </li>
                <?php endif; ?>
                <?php if( $this->helper('customer')->isRegistrationAllowed() ): ?>
                <li class="control">
                    <input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$this->getQuote()->isAllowedGuestCheckout()): ?> checked="checked"<?php endif ?> class="radio" />
                    <label for="login:register"><?php echo $this->__('Register and Checkout') ?></label>
                </li>
                <?php endif; ?>
            </ul>
        <?php else: ?>
            <input type="hidden" name="checkout_method" id="login:register" value="register" checked="checked" />
        <?php endif; ?>
        <div class="buttons-set">
            <p class="required">&nbsp;</p>
            <?php if ($this->getQuote()->isAllowedGuestCheckout()): ?>
                <button id="onepage-guest-register-button" type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
            <?php elseif ($this->helper('checkout')->isCustomerMustBeLogged()): ?>
                <button id="onepage-guest-register-button" type="button" class="button" onclick="window.location='<?php echo $this->helper('checkout/url')->getRegistrationUrl();?>'"><span><span><?php echo $this->__('Register') ?></span></span></button>
            <?php else: ?>
                <form action="<?php echo $this->getUrl('persistent/index/saveMethod'); ?>">
                    <button id="onepage-guest-register-button" type="submit" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
                </form>
            <?php endif; ?>
        </div>
    </div>
    <div class="col-2">
        <h3><?php echo $this->__('Returning Customers') ?></h3>
        <?php echo $this->getMessagesBlock()->toHtml() ?>
        <form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
        <div class="fieldset">
            <?php echo $this->getBlockHtml('formkey'); ?>
            <p class="description"><?php echo $this->__('Sign in to speed up your checkout process') ?></p>
            <p class="required"><?php echo $this->__('* Required Fields') ?></p>
            <ul class="form-list">
                <li>
                    <label for="login-email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                    <div class="input-box">
                        <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" class="input-text required-entry validate-email" id="login-email" name="login[username]" value="<?php echo $loginFormusername; ?>" />
                    </div>
                </li>
                <li>
                    <label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
                    <div class="input-box">
                        <input type="password" class="input-text validate-password required-entry" id="login-password" name="login[password]" value="<?php echo $loginFormpwd; ?>" />
                    </div>
                </li>
                <li>
                    <a href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>" class="f-left"><?php echo $this->__('Forgot your password?') ?></a>
                </li>
                <?php echo $this->getChildHtml('form.additional.info'); ?>
                <?php echo $this->getChildHtml('persistent.remember.me'); ?>
                <li class="wide">
                    <div class="input-box">
                        <div id="re_captcha_login_checkout"></div>
                    </div>
                    </li>
            </ul>
            <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
            <input name="context" type="hidden" value="checkout" />
        </div>
        </form>
        <div class="buttons-set">
            <button type="submit" class="button" onclick="onepageLogin(this)"><span><span><?php echo $this->__('Login') ?></span></span></button>
        </div>
    </div>
</div>

<script type="text/javascript">
//<![CDATA[
    var loginForm = new VarienForm('login-form', true);
    $('login-email').observe('keypress', bindLoginPost);
    $('login-password').observe('keypress', bindLoginPost);
    function bindLoginPost(evt){
        if (evt.keyCode == Event.KEY_RETURN) {
            loginForm.submit();
        }
    }
    function onepageLogin(button)
    {
        if(loginForm.validator && loginForm.validator.validate()){
            button.disabled = true;
            loginForm.submit();
        }
    }
//]]>
</script>
<?php
    $registerParam = $this->getRequest()->getParam('register');
    if ($registerParam || $registerParam === ''):
?>
    <script type="text/javascript">
    //<![CDATA[
        document.observe("dom:loaded", function() {
            if($('login:register')) {
                $('login:register').checked = true;
                checkout.setMethod();
            }
        })
    //]]>
    </script>
<?php endif; ?>

D:) Create file in app/design/frontend/rwd/default/template/customerrecaptcha/persistent/checkout/onepage/billing.phtml and add below code in it.

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     rwd_default
 * @copyright   Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/** @var Mage_Checkout_Block_Onepage_Billing $this */
?>
<script>
if(window.performance)

{

if(performance.navigation.type  == 1 )
          {
            <?php Mage::getSingleton('core/session')->unsMyValue();?>
          }
}
</script>
<form id="co-billing-form" action="">
<div class="fieldset">
    <p class="required"><?php echo $this->__('* Required Fields') ?></p>
    <ul class="form-list">
    <?php if ($this->customerHasAddresses()): ?>
        <li class="wide">
            <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
            <div class="input-box">
                <?php echo $this->getAddressesHtmlSelect('billing') ?>
            </div>
        </li>
    <?php endif; ?>
    <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?> class="scaffold-form">
        <div class="fieldset">
            <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
            <ul>
                <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
                <li class="fields">
                    <div class="field">
                        <label for="billing:company"><?php echo $this->__('Company') ?></label>
                        <div class="input-box">
                            <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->quoteEscape($this->__('Company')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
                        </div>
                    </div>
        <?php if(!$this->isCustomerLoggedIn()): ?>
                    <div class="field">
                        <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                        <div class="input-box">
                            <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
                        </div>
                    </div>
        <?php endif; ?>
                </li>
        <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
                <li class="wide">
                    <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
                    <div class="input-box">
                        <input type="text" title="<?php echo $this->quoteEscape($this->__('Street Address')) ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
                    </div>
                </li>
        <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
        <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
                <li class="wide">
                    <label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
                    <div class="input-box">
                        <input type="text" title="<?php echo $this->quoteEscape($this->__('Street Address %s', $_i)) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
                    </div>
                </li>
        <?php endfor; ?>
                <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
                <li class="wide">
                    <label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
                    <div class="input-box">
                        <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->quoteEscape($this->__('VAT Number')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
                    </div>
                </li>
                <?php endif; ?>
                <li class="fields">
                    <div class="field">
                        <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
                        <div class="input-box">
                            <input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
                        </div>
                    </div>
                    <div class="field">
                        <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
                        <div class="input-box">
                            <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
                                <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
                            </select>
                            <script type="text/javascript">
                            //<![CDATA[
                                $('billing:region_id').setAttribute('defaultValue',  "<?php echo $this->getAddress()->getRegionId() ?>");
                            //]]>
                            </script>
                            <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>"  title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
                        </div>
                    </div>
                </li>
                <li class="fields">
                    <div class="field">
                        <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
                        <div class="input-box">
                            <input type="text" title="<?php echo $this->quoteEscape($this->__('Zip/Postal Code')) ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
                        </div>
                    </div>
                    <div class="field">
                        <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
                        <div class="input-box">
                            <?php echo $this->getCountryHtmlSelect('billing') ?>
                        </div>
                    </div>
                </li>
                <li class="fields">
                    <div class="field">
                        <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
                        <div class="input-box">
                            <input type="tel" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
                        </div>
                    </div>
                    <div class="field">
                        <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
                        <div class="input-box">
                            <input type="tel" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->quoteEscape($this->__('Fax')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
                        </div>
                    </div>
                </li>

                <?php if(!$this->isCustomerLoggedIn()): ?>

        <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
        <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
            <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
                <li class="fields">
                <?php if ($_dob->isEnabled()): ?>
                    <div class="field">
                        <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
                    </div>
                <?php endif; ?>
                <?php if ($_gender->isEnabled()): ?>
                    <div class="field">
                        <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
                    </div>
                <?php endif ?>
                </li>
            <?php endif ?>

            <?php if ($this->isTaxvatEnabled()):?>
                <li><?php echo $this->getTaxvatHtml() ?></li>
            <?php endif; ?>

                <li class="fields" id="register-customer-password">
                    <div class="field">
                        <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
                        <div class="input-box">
                            <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" class="input-text required-entry validate-password" />
                        </div>
                    </div>
                    <div class="field">
                        <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
                        <div class="input-box">
                            <input type="password" name="billing[confirm_password]" title="<?php echo $this->quoteEscape($this->__('Confirm Password')) ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
                        </div>
                    </div>
                </li>
                <?php echo $this->getChildHtml('persistent.remember.me'); ?>
                <?php endif; ?>
                <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
                    <li class="control">
                        <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->quoteEscape($this->__('Save in address book')) ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
                    </li>
                <?php else:?>
                    <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
                <?php endif; ?>
                <?php echo $this->getChildHtml('form.additional.info'); ?>
            </ul>
            <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
        </div>
     </li>
    <?php if ($this->canShip()): ?>
        <li class="control">
            <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->quoteEscape($this->__('Ship to this address')) ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo  $this->__('Ship to this address') ?></label></li>
        <li class="control">
            <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->quoteEscape($this->__('Ship to different address')) ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
        </li>
        <li class="control">
            <div class="input-box">
                <div id="re_captcha_billing"></div>
            </div>
        </li>
    <?php endif; ?>        
    </ul>
    <?php if (!$this->canShip()): ?>
        <input type="hidden" name="billing[use_for_shipping]" value="1" />
    <?php endif; ?>
    <div class="buttons-set" id="billing-buttons-container">
        <button type="button" title="<?php echo $this->quoteEscape($this->__('Continue')) ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
        <span class="please-wait" id="billing-please-wait" style="display:none;">
            <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->quoteEscape($this->__('Loading next step...')) ?>" title="<?php echo $this->quoteEscape($this->__('Loading next step...')) ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
        </span>
    </div>
    
</div>
</form>
<script type="text/javascript">
//<![CDATA[
    var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
    var billingForm = new VarienForm('co-billing-form');

    //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->jsQuoteEscape($this->__('Select State/Province...')) ?>');
    $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);

    var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
    if ($('onepage-guest-register-button')) {
        Event.observe($('onepage-guest-register-button'), 'click', function(event) {
            var billingRememberMe = $('co-billing-form').select('#remember-me-box');
            if (billingRememberMe.length > 0) {
                if ($('login:guest') && $('login:guest').checked) {
                    billingRememberMe[0].hide();
                } else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
                    billingRememberMe[0].show();
                }
            }
        });
    }
//]]>
</script>

E:) Create file in app/design/frontend/rwd/default/template/customerrecaptcha/customer/form/forgotpassword.phtml and add below code in it.

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     rwd_default
 * @copyright   Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="page-title">
    <h1><?php echo $this->__('Forgot Your Password?') ?></h1>
</div>
<script src="https://www.google.com/recaptcha/api.js?onload=renderReCaptcha&render=explicit&hl=<?php echo $this->escapeHtml($this->getLang()); ?>" async defer></script>
    <script type="text/javascript">
        function renderReCaptcha() {
            grecaptcha.render('re_captcha_forgotpwd', {
              sitekey: '<?php echo $this->escapeHtml($this->getSitekey()); ?>',
              theme: '<?php echo $this->escapeHtml($this->getTheme()); ?>',
              lang: '<?php echo $this->escapeHtml($this->getLang()); ?>'
            });
        }
    </script>
<?php $frgtpwdForm = Mage::getSingleton('core/session')->getData('frgtpwdForm'); ?>
<?php //$frgtpwdForm = $frgtpwdForm ? $frgtpwdForm : new Varien_Object(); ?>
<?php $frgtpwdFormEmail = ($frgtpwdForm['email']) ? $frgtpwdForm['email'] : $this->escapeHtml($this->getEmailValue()); ?>
    
<?php echo $this->getMessagesBlock()->toHtml() ?>
<form action="<?php echo $this->getUrl('*/*/forgotpasswordpost') ?>" method="post" id="form-validate">
    <div class="fieldset">
        <h2><?php echo $this->__('Retrieve your password here') ?></h2>
        <p class="form-instructions"><?php echo $this->__('Please enter your email address below. You will receive a link to reset your password.') ?></p>
        <p class="required"><?php echo $this->__('* Required Fields') ?></p>
        <ul class="form-list">
            <li>
                <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                <div class="input-box">
                    <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="email" alt="email" id="email_address" class="input-text required-entry validate-email" value="<?php echo $frgtpwdFormEmail;?>" />
                </div>
            </li>
            <?php echo $this->getChildHtml('form.additional.info'); ?>
            <li class="wide">
                <div class="input-box">
                    <div id="re_captcha_forgotpwd"></div>
                </div>
               </li>
        </ul>
    </div>
    <div class="buttons-set">
        <p class="back-link"><a href="<?php echo $this->helper('customer')->getLoginUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back to Login') ?></a></p>
        <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Submit')) ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
    </div>
</form>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('form-validate', true);
//]]>
</script>

Now go to System >> Configuration >> Customer Configuration and Select Forms on which you want to display Google reCAPTCHA.

You can check code or download from it here.

You will find reCAPTCHA as per below screenshot.




Download Full Module from Github at: https://github.com/vijayrami/Customer_reCAPTCHA_Login_Register_Billing_ForgetPW
Tag : Magento
1 Comments On "Add Google reCAPTCHA in Customer Account Login, Account Register, Forgot password and Billing Page in Magento"

The blog was absolutely fantastic! Lot of great information which can be helpful in some or the other way. Keep updating the blog, looking forward for more contents...Great job, keep it up..
ecommerce website development company | ECommerce Development Company in Bangalore|Ecommerce Website Design and Development Company in Bangalore | Magento Development Company

Back To Top