Plugin Directory

Changeset 2160015


Ignore:
Timestamp:
09/20/2019 12:12:44 PM (6 years ago)
Author:
jobprogress
Message:

Captcha Bug fixes

Location:
contractor-contact-form-website-to-workflow-tool/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • contractor-contact-form-website-to-workflow-tool/trunk/css/custom.css

    r2093546 r2160015  
    358358    display: table-cell;
    359359    width: 50%;
     360    vertical-align: top;
    360361}
    361362.customer-page-container .inline-fields-col:first-child {
  • contractor-contact-form-website-to-workflow-tool/trunk/js/custom.js

    r2093546 r2160015  
    246246    function createCaptcha() {
    247247        //clear the contents of captcha div first
    248         document.getElementById('jp_captcha').innerHTML = "";
    249         var charsArray =
    250         "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*";
    251         var lengthOtp = 6;
    252         var captcha = [];
    253         for (var i = 0; i < lengthOtp; i++) {
    254             //below code will not allow Repetition of Characters
    255             var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array
    256             if (captcha.indexOf(charsArray[index]) == -1)
    257                 captcha.push(charsArray[index]);
    258             else i--;
     248        if(document.getElementById('jp_captcha')) {
     249            document.getElementById('jp_captcha').innerHTML = "";
     250            var charsArray =
     251            "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*";
     252            var lengthOtp = 6;
     253            var captcha = [];
     254            for (var i = 0; i < lengthOtp; i++) {
     255                //below code will not allow Repetition of Characters
     256                var index = Math.floor(Math.random() * charsArray.length + 1); //get the next character from the array
     257                if (captcha.indexOf(charsArray[index]) == -1)
     258                    captcha.push(charsArray[index]);
     259                else i--;
     260            }
     261            var canv = document.createElement("canvas");
     262            canv.id = "jp_captcha_img";
     263            canv.width = 100;
     264            canv.height = 50;
     265            var ctx = canv.getContext("2d");
     266            ctx.font = "25px Georgia";
     267            ctx.strokeText(captcha.join(""), 0, 30);
     268            //storing captcha so that can validate you can save it somewhere else according to your specific requirements
     269            code = captcha.join("");
     270            document.getElementById("jp_captcha").appendChild(canv); // adds the canvas to the body element
    259271        }
    260         var canv = document.createElement("canvas");
    261         canv.id = "jp_captcha_img";
    262         canv.width = 100;
    263         canv.height = 50;
    264         var ctx = canv.getContext("2d");
    265         ctx.font = "25px Georgia";
    266         ctx.strokeText(captcha.join(""), 0, 30);
    267         //storing captcha so that can validate you can save it somewhere else according to your specific requirements
    268         code = captcha.join("");
    269         document.getElementById("jp_captcha").appendChild(canv); // adds the canvas to the body element
    270272    }
    271273    createCaptcha();
  • contractor-contact-form-website-to-workflow-tool/trunk/readme.txt

    r2093660 r2160015  
    2020
    2121== Changelog ==
     22= 3.0.4 =
     231. Captcha Bug fixes
     24
    2225= 3.0.3 =
    23261. Enable Canadian Zip Code
Note: See TracChangeset for help on using the changeset viewer.