8.3.0 Captcha fails until image manually reloaded

Permalink 0 1 Browser Info Environment
Captcha in core form block always fail until the image is clicked (manually reloaded), then it passes once and keeps failing until the image is manually reloaded again.

To replicate:

1. Place 2 or more form blocks on a page
2. enter captcha code - fails
3. click on captcha image to reload - passes
4. enter captcha code - fails
and so on


Status: New
linuxoid
linuxoid replied on at Permalink Reply 1 Attachment
linuxoid
Some further info.

I made a form block package where I added a unique block ID to the captcha image in view:
$captcha->setPictureAttributes([
    'id' => 'captcha_img'.$bUID,
]);

and then reload the image in jQuery itself:
$('#captcha_img'+bUID).attr('src', $('#captcha_img'+bUID).attr('src').replace(/([?&]nocache=)(\d+)/, '$1' + ((new Date()).getTime())));

and now all forms pass the captcha test, multiple forms on the same page. If I switch back to the core's default captcha library, the tests fail randomly again.

See the attached screen capture (sorry for that not being in English, but it's clear that the failure is shown in red, when it passes it's green).
linuxoid replied on at Permalink Reply 1 Attachment
linuxoid
Ok, I've made a clean install of v8.3.0, no packages installed, a pure C5. Added a new page 'Test', added 3 core form blocks. Attached is a screen capture.

As you can see, captcha fails until the image is manually reloaded with a click. Sometimes, sometimes (!) it starts passing from the very beginning, but then randomly fails and the same stuff happens.
andrew replied on at Permalink Reply
andrew
I can't seem to replicate this – it might be related to your testing with multiple form blocks on the same page, which isn't something we run into very often.
mlocati replied on at Permalink Reply
mlocati
This issue occurs when you have multiple captchas in the same page.

concrete5 Environment Information

# concrete5 Version
Core Version - 8.3.0
Version Installed - 8.3.0
Database Version - 20171129190607

# concrete5 Packages
Community Store (1.3.1), ExchangeCore reCAPTCHA (1.1.1)

# concrete5 Overrides
None

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
apache2handler

# PHP Version
7.0.7

# PHP Extensions
apache2handler, bz2, Core, ctype, curl, date, dom, fileinfo, filter, gd, gettext, hash, iconv, json, libxml, mbstring, mcrypt, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
sql.safe_mode - Off
upload_max_filesize - 2M
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200

Browser User-Agent String

Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0