Subscribe: RSS
  • I really like MODx smiley I especially like how accessible the core code is when you want to make a modification. One of the things that really bugged me about MODx is how the Veriword Captcha is displayed - both the look of it and the default words used for the captcha. I really didn’t want my clients having to type in words like Zygote,BitCode,MODx,etc. I just wanted a ’normal’ looking captcha with random characters. So I modified the veriword script to output what I think looks nice, and it uses a random string of characters. I just wanted to post the code and images that I redid in case someone else wanted a different look, or wanted to see what I did so they could make the captcha look how they wanted. It isn’t too hard if you know PHP and an image manipulation tool like Photoshop or the Gimp.

    Here is an example of what the script looks like (used with the eForm snippet).

    Enjoy,
    James
    • Does look much better indeed. Thanks for sharing. smiley
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • anyway to make it non case sensitive?
        I tried just lowercase the letters in the file but that makes the letters sometime* unreadable inside the box as they drop down...
        • I don’t think it’s available as a settable option, but you could easily change the code that evaluates the user’s input against the $_SESSION variable to do a case-insensitive compare.  These are off the top of my head and untested:

          If it’s eForm that’s doing the check for example, you’d need to change this line (line 178 in eform.inc.php):

          if($fields['vericode']!=$code) {

          to
          if (strtolower($fields['vericode']) !=  strtolower($code) ) {


          or

          if (strcasecmp($fields['vericode'], $code) == 0) {

          Which might be a little faster.

          WebLoginPE, OTOH, has

          if ($_SESSION['veriword'] !== $formcode)


          which could be changed to

          if (strcasecmp($_SESSION['veriword'],formcode) != 0)


          The Manager login comparison is in manager/processors/login.processor.php:

          elseif ($_SESSION['veriword'] != $captcha_code) {


          would change to

          elseif (strcasecmp($_SESSION['veriword'],$captcha_code) != 0 )  {



          Note that if the captcha words have non-English characters (e.g. é), you might need a more complicated comparison function.
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/MODx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
          • consider
            if (strcasecmp($fields['vericode'], $code) == 0) {
            


            as tested. it works perfect smiley

            however the manager capacha gives an error in the related file. mind trying again that one?
            • Quote from: sinbad at Dec 04, 2008, 06:30 AM

              . . . however the manager capacha gives an error in the related file. mind trying again that one?

              Oops, missing right bracket and right parend. It should be:

              elseif (strcasecmp($_SESSION['veriword'],$captcha_code) != 0) {

              (fixed in post above also -- I hope).

              Thanks for checking.

              Bob
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/MODx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
              • Thank you BobRay!! smiley
                  @hawproductions | http://mrhaw.com/

                  Infograph: MODX Advanced Install in 7 steps:
                  http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                  Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                  http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                • No, thank YOU for checking. This works well. Guess we have both tested. sorry don’t have WLPE.
                  Thank you very much!
                  • btw, for the standard modx capacha you can simply type your words in lower case. I use this modified capacha from devtrench and don’t want to lose users due to frustration so bob’s solution is perfect...
                    • Nice tip, bookmarked grin

                      BobRay is becoming quite an encyclopedia of modx code (old and new), I am impressed that he knew all those code bits off the top of his head (I would have been opening files and searching for hours). Looks like another team member who ’eats php for breakfast’ grin grin grin
                        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                        Something is happening here, but you don't know what it is.
                        Do you, Mr. Jones? - [bob dylan]