Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
I've added this functionality into image_captcha module, i hope you'll decide to apply it to the main branch ;)
Patch adds a new system variable 'image_captcha_image_reload_button' (a checkbox) at image captcha admin page which is disabled by default.
Comment | File | Size | Author |
---|---|---|---|
#33 | 654118_image-reload-03.patch | 2.06 KB | bartoll |
#33 | 654118_image-reload-04.patch | 2.38 KB | bartoll |
#15 | 654118_image-reload-02.patch | 2.36 KB | soxofaan |
#12 | 654118_reloadable_image_captcha.patch | 4.77 KB | kscheirer |
#10 | 654118_image-reload.patch | 2.2 KB | soxofaan |
Comments
Comment #1
Riki_tiki_tavi CreditAttribution: Riki_tiki_tavi commentedHere how it looks like
Comment #2
soxofaan CreditAttribution: soxofaan commentedThat's funny, I worked yesterday on the same thing.
My patch (very basic, work in progress) is in attachment. The main difference is that it just reloads the image, but keeps the code. Currently reloading is triggered by clicking the image (so no text clues yet).
Some remarks on you patch:
-u
and-p
options (see http://drupal.org/patch/create, under patch readability). Also see my patch.variable_get('image_captcha_image_reload_button', 0)
andvariable_get('image_captcha_image_reload_button', FALSE)
'#title' => t('Add a "reload captcha" link'),
write CAPTCHA with all capitals (it's an abreviation)id="image-captcha"
on the image, but there could be several CAPTCHA images on the same page, so the ID should be unique. I appended the CAPTCHA session ID to make it unique (see my patch)drupal_add_js('misc/jquery.js');
this is done automatically if you use drupal_add_js. See my patch.I'm not in favor of writing to the captcha_session table in a place where we should only read. This feels like a hack and we should come up with a better solution here (that's why I limited my solution to reloading the image, but keeping the code). There is also code duplication for generating a new code.
In short, apart from some code style issues: I would first try to implement a simple reload feature, which keeps the code.
I think it's better/easier/cleaner to implement the generating-a-new-challenge in the CAPTCHA core module, so it can be applied to all sorts of challenges (like math, CSS CAPTCHA, text CAPTCHA, ...)
Anyway, thanks for your work
Comment #3
soxofaan CreditAttribution: soxofaan commentedAlso, this is more or less a duplicate of #180328: AHAH/AJAX request for new challenge, but if we limit this thread to just reloading the image while keeping the code, we can keep this issue separate and do the generating-a-new-challenge feature in the other thread.
Comment #4
Riki_tiki_tavi CreditAttribution: Riki_tiki_tavi commentedOoops. Sorry, i'm not quite familiar with patches :)
And yes, you're right it's a fast hack ;)
And I hope there would be a smooth solution for reloading in next versions of the CAPTCHA. Thanks.
Comment #5
suresh.gju CreditAttribution: suresh.gju commentedHi
I have also made fixes in image captcha module to give refresh functionality.
You can read this post http://drupal.org/node/274173#comment-1042232
Preview : http://sureshyadav.com/files/captcha.jpeg
You can verify at http://sureshyadav.com/user/register
(register please)
You can download the source code for captcha module from here:
http://sureshyadav.com/content/drupal-image-captcha-with-refresh-link
www.sureshyadav.com
-----------------------------------
When problem is clear, solution is near.
Comment #6
shenzhuxi CreditAttribution: shenzhuxi commentedThe patch work great!
Confirmed.
; $Id: image_captcha.info,v 1.5 2008/02/17 12:49:24 soxofaan Exp $
name = "Image CAPTCHA"
description = "Provides an image based CAPTCHA. +patch http://drupal.org/node/654118"
package = "Spam control"
dependencies[] = captcha
core = 6.x
; Information added by drupal.org packaging script on 2010-03-18
version = "6.x-2.x-dev"
core = "6.x"
project = "captcha"
datestamp = "1268870551"
Comment #7
andyceo CreditAttribution: andyceo commentedWell, this looks good for me. Want to see that in the next CAPTCHA release.
Comment #8
shenzhuxi CreditAttribution: shenzhuxi commentedWhy not merge to the trunk?
Comment #9
szadok CreditAttribution: szadok commentedWhich patch worked great?
Comment #10
soxofaan CreditAttribution: soxofaan commentedreroll
Comment #11
mustafa1453 CreditAttribution: mustafa1453 commented#10: 654118_image-reload.patch queued for re-testing.
Comment #12
kscheirerSomething like this would be nice to get in...
I needed a patch similar to whats described in #1 - reload the image with a new code via ajax so the whole form doesn't need a refresh.
The attached patch is largely based on the code in #1, but as a standard unified drupal patch, and fixes some of the recommendations in #2 (still doesn't use js to write the reload link), updated to apply to version 6.x-2.2.
I'm leaving the status as RTBC for #10, but I'm posting this code in the hope that we can get a full image reload in.
Comment #14
kscheirersorry, should stay at RTBC for #10.
Comment #15
soxofaan CreditAttribution: soxofaan commentedreroll of patch from #10
Comment #16
Stan.Ezersky CreditAttribution: Stan.Ezersky commentedsoxofaan, thanks!
#15 works
Comment #17
jerry2.0 CreditAttribution: jerry2.0 commentedComment #18
soxofaan CreditAttribution: soxofaan commentedresetting title
Comment #19
awasson CreditAttribution: awasson commentedSubscribing.
Thanks soxofaan. Your patch at #15 works perfectly.
Comment #20
nagini CreditAttribution: nagini commentedimage_captcha.admin_.inc_.patch queued for re-testing.
Comment #21
Dubber Dan CreditAttribution: Dubber Dan commentedHave manually made the changes as per #15 (as I've never got round to figuring out how to run a patch) but it doesn't make any difference and there's still no option to reload the image
http://www.elementsforlife.co.uk/shop/raw-chocolate-making-kits/raw-choc...
Anyone got suggestions?
Comment #22
awasson CreditAttribution: awasson commentedIf you've done it correctly, you can click on the image and it will reload itself with the same set of characters but with varied sized letters and numbers which should make it easier to read. To make that useful, I find it best to edit the captcha message to say something like:
"This question is to prevent automated spam submissions.
If you find the image difficult to read, click it to reload."
Comment #23
Dubber Dan CreditAttribution: Dubber Dan commentedIn that case something ain't right as it doesn't reload on clicking
Comment #24
wundo CreditAttribution: wundo commentedDubber, I just went to your website and tested the CAPTCHA image reloading and it's working. Changing this as RTBC
Comment #25
soxofaan CreditAttribution: soxofaan commentedOk, committed patch from #15 then
to be ported to Drupal 7 version
Comment #26
mjRocks CreditAttribution: mjRocks commentedComment #27
soxofaan CreditAttribution: soxofaan commented6.x-1.x is not supported anymore
Comment #28
donahoche CreditAttribution: donahoche commentedimage_captcha.admin_.inc_.patch queued for re-testing.
Comment #29
AnybodyHi,
I could not find a reload functionality in the 6.2.x Version yet. Can anyone please tell, what's the case here and when this will be finally fixed (for D6)?
The 6.2.x seemed to be working already?!
Comment #30
soxofaan CreditAttribution: soxofaan commented@Anybody in #29:
the feature is in version 6.x-2.x-dev for the moment (not in 6.x-2.4, it will be in 6.x-2.5)
note that it is a minor feature: there are no UI-strings indicating the feature, you just have to click the image
Comment #31
Leagnus CreditAttribution: Leagnus commentedFor 7.9 works:
Comment #32
rogical CreditAttribution: rogical commentedCan you provide a git patch so that users can get tested easily?
http://drupal.org/project/captcha/git-instructions -- Creating a patch
Comment #33
bartoll CreditAttribution: bartoll commentedHere there are patches that work for me.
First patch alloww reload captcha after clicking an image, second adds additional link to reload captcha.
Comment #35
ramsegal CreditAttribution: ramsegal commentedbartoll - i tried using it, the captcha string doesnt change....the picture is re-rendered, but with the same characters.
Comment #36
rogical CreditAttribution: rogical commentedhttp://drupal.org/project/draggable_captcha supports ajax refresh now.
Comment #37
ddrozdik CreditAttribution: ddrozdik commentedHi, try to use this module http://drupal.org/project/image_captcha_refresh for drupal 7.
If need for drupal 6 I will try to port it.
Comment #38
naveenvalechaMoving this to 8.x
Comment #39
couturier CreditAttribution: couturier as a volunteer commentedThe 8.x version is needing some extra help. Is anyone able to assist? We still don't have a stable 8.x release.
Comment #40
AnybodyThis has been fixed in #2608540: Add Image CAPTCHA Refresh to the module patch for Drupal 8.