Welcome to TalkGraphics.com
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Apr 2015
    Location
    New Mexico
    Posts
    24

    Lightbulb TFmail Contact Form with reCAPTCHA v2 and Perl

    I thought I would share my experience here with others. I am evolving my own website and also create websites for others. I like to have a contact form and have endured SPAM in the past. I really liked the new Version 2 of Google's reCAPTCHA, so tried to integrate that. I also have preference for a form that is handled by my own web sever -- not one that is outsourced to a 3rd party like Jotform or another. Controlling everything on your own server seems like it gives you a lot more control. I am still working out a few bugs.

    My experience in the past was with the old "BNBForm" code, which was in Perl. I decided to try TFMail package which is also in Perl. I like a scripting language so one can modify the results. I am not a Perl programmer but know how to teach myself with some old experience in many other languages.

    Accomplishments:
    ==============

    (1) Got TFMail going on my own form. I coded a form by hand in HTML. Using a generator and modifying it would be just as good... or better.

    It is fairly powerful and flexible, once all the peculiarities are worked out with your server.

    (2) Got Google reCAPTCHA working on the form in a placeholder in Xara and using very simple server-side Perl programming.

    There is almost no documentation on the Version 2 reCAPTCHA for Perl. I had to scrounge all over the web and teach myself a little Perl. There is a Captcha::reCAPTCHA:V2 library out there (V2.pm) but it didn't work for me and it is way more than I needed since I was handling the form in HTML as Google seems to suggest is easiest.

    (3) I modified TFmail to handle capturing an error from no reCAPTCHA on a submitted form.

    This uses a new template in TFmail to explain to the user that they should push the back button and do it again.

    I would be happy to share my code changes with anyone if they want to do this.


    Issues Remaining:
    =============

    (1) I have not yet gotten TFmail to send a confirmation notice to the user if they entered their email address. Not sure why yet. TFmail authors were adamant that this should not be done because it would allow others to SPAM people via your email server. I think this almost goes away with reCAPTCHA, but I think the authors may be causing this issue with too much caution. Need to learn more Perl or get help from one of you.

    (2) Two Xara variants are not displaying the reCAPTCHA box on the form.

    I am not sure why this is. The first website I am trying this on has three variants. I have HTML/Javascript statement for the code in the head of the placeholder. I also have the form showing in all variants via placeholder body code. The reCAPTCHA shows and works on the main variant, but does not show on the other two variants -- although the form and submit button show on those two variants.

    I speculated that Google would only serve one, but when I reload in the errant variants, the reCAPTCHA does not show there -- only on the main. I read this forum in a few places and it seems that <iframe> export on Jotforms solved this similar problem on other sites. I have since forgotten what <iframe> is, but will look it up and give it a try.

    If anyone has solutions to the above two issues or wants to see the whole Perl code for the reCAPTCHA v2, let me know here.

  2. #2
    Join Date
    Apr 2015
    Location
    New Mexico
    Posts
    24

    Default Re: TFmail Contact Form with reCAPTCHA v2 and Perl

    I have an update about the second issue... reCAPTCHA not displaying in the placeholder on the two smaller variants out of three.

    I performed two experiments.

    (A) Tried a fresh browser that was very narrow to bring up the mobile variant immediately, no cookies, etc. When I did that no reCAPTCHA appeared. Widening the display it only came up under the main widest variant. So, it's not the variant that comes up first that gets the reCAPTCHA, it is likely the main variant.

    (B) I eliminated the reCAPTCHA and web form from just the main variant without altering the two smaller variants. Upon loading the web page, the middle variant got the reCAPTCHA, not the smaller one. Therefore this is not an issue with the middle variant being able to display the reCAPTCHA.

    This appears to be an incompatibility with Google serving up the reCAPTCHA box and Xara's variants. Xara seems to deliver the reCAPTCHA box to only the main or widest variant -- even if it is not being displayed. It is not re-rendered or called upon the browser width dynamically changing. Furthermore, the initial browser width does not matter -- XARA seems to deliver the reCAPTCHA box to the widest variant or perhaps some other order in how the variants are stored.

    It would seem that Xara needs to both re-render the variant page upon dynamic changes and make sure external content is delivered to the correct variant. Xara, what do you have to say about this? Thanks!

  3. #3
    Join Date
    Apr 2015
    Location
    New Mexico
    Posts
    24

    Default Re: TFmail Contact Form with reCAPTCHA v2 and Perl

    To continue "dancing with myself" I thought of another experiment. I obtained a second Google reCATPCHA V2 key pair. You can get more than one key pair from Google. I placed different public keys in the main and medium variants of my website. I thought it might eliminate one potential problem -- Google serving out more than one reCAPTCHA widget near the same time with the same public key. Worth a try.

    Didn't work. Same behavior. Only the main variant displays a box. The medium variant didn't display the reCATPCHA box/widget even if I reloaded the page.

    This makes me think there is some issue with Xara.

    If this had worked, it would have been a pain because then I would have to try multiple keys on my server-side handling of the second response from Google. That might not have even worked because of some limitation with Google -- dunno.

  4. #4
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,518

    Default Re: TFmail Contact Form with reCAPTCHA v2 and Perl

    Interesting to see a fellow New Mexican working this out.

    Maybe one of our more recaptcha savvy members will check in with a suggestion.

  5. #5
    Join Date
    Apr 2015
    Location
    New Mexico
    Posts
    24

    Default Re: TFmail Contact Form with reCAPTCHA v2 and Perl

    Quote Originally Posted by gwpriester View Post
    Interesting to see a fellow New Mexican working this out.

    Maybe one of our more recaptcha savvy members will check in with a suggestion.
    Yes-- you and I know that New Mexico exists because we are. It's between Arizona and Texas!

    Stereograms? I used to have a program that I kept working forever until Windows 7 or 10 called "Stare-EO Workshop" and made my own stereograms (not that sophisticated). Wrote NE Thing Enterprises and found out they no longer did this. Didn't realize another company did it!

  6. #6
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,518

    Default Re: TFmail Contact Form with reCAPTCHA v2 and Perl

    I heard back from Xara that they have received your ticket and will have a better idea what is going on when they see the script.

    Nobody knows about New Mexico because the weather person always stands in front of the state on the weather map and points to Arizona and California, and turns and points to Texas and the southern states.

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •