Author: hansbak
Date: Mon Mar 16 07:02:47 2009
New Revision: 754827
URL: http://svn.apache.org/viewvc?rev=754827&view=rev
Log:
captcha not always visible...
Modified:
ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java
ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java?rev=754827&r1=754826&r2=754827&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java Mon Mar 16
07:02:47 2009
@@ -33,6 +33,8 @@
import java.io.File;
import java.io.IOException;
import java.util.Date;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilDateTime;
public class Captcha {
@@ -144,23 +146,18 @@
public static void writeImage(BufferedImage image, HttpServletRequest
request)
{
try {
+ String FILE_PATH = File.separator + "runtime" + File.separator +
"tempfiles" + File.separator + "captcha" + File.separator;
+ String URL_FILE_PATH = "/tempfiles/captcha/";
CAPTCHA_FILE_PATH = new java.io.File(".").getCanonicalPath();
- CAPTCHA_FILE_PATH += File.separator + "runtime" + File.separator +
"tempfiles";
- CAPTCHA_FILE_PATH += File.separator + "captcha" + File.separator;
+ CAPTCHA_FILE_PATH += FILE_PATH;
File test = new File(CAPTCHA_FILE_PATH);
if (!test.exists()) {
test.mkdir();
}
- CAPTCHA_FILE_NAME = UtilHttp.getSessionId(request).substring(0,6);
- CAPTCHA_FILE_NAME +=
UtilHttp.getSessionId(request).substring(UtilHttp.getSessionId(request).length()-11,UtilHttp.getSessionId(request).indexOf("."))+"_";
- Date date = new Date();
- CAPTCHA_FILE_NAME += date.toString()+".jpg";
- CAPTCHA_FILE_PATH += CAPTCHA_FILE_NAME;
- request.setAttribute("fileName", CAPTCHA_FILE_NAME);
+ CAPTCHA_FILE_NAME = UtilDateTime.nowAsString().concat(".jpg");
+ request.setAttribute("fileName", URL_FILE_PATH +
CAPTCHA_FILE_NAME);
request.setAttribute("ID_KEY", ID_KEY);
- System.out.println("\n\nPath = "+CAPTCHA_FILE_PATH+"\n");
- System.out.println("Captcha Key = "+ID_KEY+"\n\n");
- ImageIO.write(image, "jpg", new File( CAPTCHA_FILE_PATH ));
+ ImageIO.write(image, "jpg", new File( CAPTCHA_FILE_PATH +
CAPTCHA_FILE_NAME));
} catch (IOException e) {
return;
}
Modified: ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml?rev=754827&r1=754826&r2=754827&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml Mon Mar 16
07:02:47 2009
@@ -265,7 +265,7 @@
<field name="PASSWORD" title="${uiLabelMap.CommonPassword}"
tooltip="${uiLabelMap.CommonRequired}" widget-style="required"><password
size="15" maxlength="250"/></field>
<field name="CONFIRM_PASSWORD" title="${uiLabelMap.CommonPassword}"
tooltip="* ${uiLabelMap.CommonConfirm}" widget-style="required"><password
size="15" maxlength="250"/></field>
<field name="VerifyCaptchaTitle" title="${uiLabelMap.VerifyCaptcha}"
title-area-style="group-label"><display description=" "
also-hidden="false"/></field>
- <field name="picOfcaptcha"
title="${uiLabelMap.PicCaptcha}TEST:${parameters.ID_KEY}"><image
value="/tempfiles/captcha/${parameters.fileName}"></image></field>
+ <field name="picOfcaptcha" title="${uiLabelMap.PicCaptcha}"><image
value="${parameters.fileName}"></image></field>
<field name="reload" title=" "><hyperlink target="newRegisterLogin"
description="${uiLabelMap.MyPortalReloadImage}"/></field>
<field name="captcha" title="${uiLabelMap.VerifyCaptcha}"
tooltip="${uiLabelMap.CommonRequired}" widget-style="required"><text size="23"
maxlength="30"/></field>
<field name="submitButton" title="${uiLabelMap.CommonSave}"
title-area-style="group-label"><submit button-type="button"/></field>