How to prevent spam customers registering with Chinese and some other languages with multiple accounts.

For this I have done input fields not to paste but also other language accounts are being created.

Also planning for google recaptcha but not sure this will this fix the issue.

please help me how to fix this issue.

  • 1
    google recaptcha will fix this problem. i faced the same problem of spam after tried other solution's at the end i used google recaptcha. Aug 8, 2018 at 8:06
  • ok thanks i am installing the recaptcha in live now
    – Raghu
    Aug 8, 2018 at 8:12
  • This is a very nice Google reCaptcha plugin: github.com/StudioForty9/Recaptcha
    – BlueC
    Aug 8, 2018 at 20:44

1 Answer 1


Here i show you how to validate google reCaptcha. open your phtml file put below code. please review and update form name .

<form name="freeeventForm" id="freeeventForm">
    <div id="RecaptchaField"></div>
    <input type="hidden" class="validate-reCAPTCHA">

<script src="https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit" async defer></script>
<script type="text/javascript">
    //< ![CDATA[
        var CaptchaCallback = function() {  
        grecaptcha.render('RecaptchaField', {'sitekey' : '6LeuiDwUAAAAALByt-xxxxxxxxxxx-xUsZHFkeEP'});
    var customForm = new VarienForm('freeeventForm');
    Validation.add('validate-reCAPTCHA','reCAPTCHA is mandatory',function(){
        var response = grecaptcha.getResponse();
        if (response.length === 0) {
                return false;
        return true;

Add server side validation. use below code to validation google reCaptcha on server side.

public function checkCaptcha(array $post)
    if ($post['g-recaptcha-response']) {
        $captcha = $post['g-recaptcha-response'];

        $secretKey = Mage::helper('gorilla_recaptcha')->getRecaptchaPrivateKey(); // replace this with private key
        $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretKey . "&response=" . $captcha);
        $responseKeys = json_decode($response, true);

        if (intval($responseKeys["success"]) !== 1) {
            return "failed";
        } else {
            return "success";
    else {
        return "failed";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.