Follow-up to feature #3526: Cleanup parameters of new captcha image
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 1 Jun 2009 22:55:17 +0000 (22:55 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 1 Jun 2009 22:55:17 +0000 (22:55 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/sr_freecap/trunk@20896 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
pi2/freeCap.js

index a308ecc..2dd4a7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
        * Added feature #3526: Use eID API for graphical and audio captcha generation.
        * Follow-up to #3526 for TYPO3 < 4.3: Use eID API for graphical and audio captcha generation.
        * Fixed bug #3530: Morphed image blocks background type not working.
+       * Follow-up to feature #3526: Cleanup parameters of new captcha image
 
 2009-05-29  Stanislas Rolland  <typo3@sjbr.ca>
 
index adc5101..7938988 100644 (file)
@@ -41,11 +41,13 @@ function newFreeCap(id, noImageMessage) {
        if (document.getElementById) {
                        // extract image name from image source (i.e. cut off ?randomness)
                var theImage = document.getElementById("tx_srfreecap_pi2_captcha_image_"+id);
-               var parts = theImage.src.split("&amp");
+               var parts = theImage.src.split("&");
                        // add ?(random) to prevent browser/isp caching
-                       // parts[0] should be id=page_id
-                       // parts[1] should be L=sys_language_uid
-               theImage.src = parts[0] + "&amp;" + parts[1] + "&amp;set=" + Math.round(Math.random()*100000);
+                       // parts[0] should be base url up to eID parameter
+                       // parts[1] should be id=page_id
+                       // parts[2] should be L=sys_language_uid
+               var LParameterInUse = (typeof(parts[2]) != "undefined") && (parts[2].indexOf("L=") != -1);
+               theImage.src = parts[0] + "&" + parts[1] + (LParameterInUse ? "&" + parts[2] : "") + "&set=" + Math.round(Math.random()*100000);
        } else {
                alert(noImageMessage ? noImageMessage : "Sorry, we cannot autoreload a new image. Submit the form and a new image will be loaded.");
        }