You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2009/01/06 20:53:12 UTC

svn commit: r732083 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Author: adrianc
Date: Tue Jan  6 11:53:12 2009
New Revision: 732083

URL: http://svn.apache.org/viewvc?rev=732083&view=rev
Log:
Fixed a bug where a login prompt appeared in lookup windows when cookies are disabled - reported in https://issues.apache.org/jira/browse/OFBIZ-253.

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=732083&r1=732082&r2=732083&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Tue Jan  6 11:53:12 2009
@@ -2201,7 +2201,7 @@
             writer.append(modelFormField.getParameterName(context));
             writer.append(",'");
         }
-        writer.append(lookupField.getFormName(context));
+        writer.append(appendExternalLoginKey(lookupField.getFormName(context)));
         writer.append("'");
         List targetParameterList = lookupField.getTargetParameterList();
         if (targetParameterList.size() > 0) {
@@ -2227,6 +2227,19 @@
         //appendWhitespace(writer);
     }
 
+    protected String appendExternalLoginKey(String target) {
+        String result = target;
+        String externalLoginKey = (String) this.request.getAttribute("externalLoginKey");
+        if (UtilValidate.isNotEmpty(externalLoginKey)) {
+            if (target.contains("?")) {
+                result = target + "&externalLoginKey=" + externalLoginKey;
+            } else {
+                result = target + "?externalLoginKey=" + externalLoginKey;
+            }
+        }
+        return result;
+    }
+
     public void renderNextPrev(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException {
         boolean ajaxEnabled = false;
         List<ModelForm.UpdateArea> updateAreas = modelForm.getOnPaginateUpdateAreas();



Re: svn commit: r732083 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by Adrian Crum <ad...@hlmksw.com>.
David,

Thanks for the tip! I'll make the necessary change.

-Adrian

David E Jones wrote:
> 
> Wouldn't it work better to append the jsessionid?
> 
> If the user hits another page (in another tab or window) after hitting 
> the page the link to the popup was on then the externalLoginKey won't be 
> valid any more, but a jsessionid still will be.
> 
> -David
> 
> 
> On Jan 6, 2009, at 11:53 AM, adrianc@apache.org wrote:
> 
>> Author: adrianc
>> Date: Tue Jan  6 11:53:12 2009
>> New Revision: 732083
>>
>> URL: http://svn.apache.org/viewvc?rev=732083&view=rev
>> Log:
>> Fixed a bug where a login prompt appeared in lookup windows when 
>> cookies are disabled - reported in 
>> https://issues.apache.org/jira/browse/OFBIZ-253.
>>
>> Modified:
>>    
>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java 
>>
>>
>> Modified: 
>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=732083&r1=732082&r2=732083&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java 
>> (original)
>> +++ 
>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java 
>> Tue Jan  6 11:53:12 2009
>> @@ -2201,7 +2201,7 @@
>>             writer.append(modelFormField.getParameterName(context));
>>             writer.append(",'");
>>         }
>> -        writer.append(lookupField.getFormName(context));
>> +        
>> writer.append(appendExternalLoginKey(lookupField.getFormName(context)));
>>         writer.append("'");
>>         List targetParameterList = lookupField.getTargetParameterList();
>>         if (targetParameterList.size() > 0) {
>> @@ -2227,6 +2227,19 @@
>>         //appendWhitespace(writer);
>>     }
>>
>> +    protected String appendExternalLoginKey(String target) {
>> +        String result = target;
>> +        String externalLoginKey = (String) 
>> this.request.getAttribute("externalLoginKey");
>> +        if (UtilValidate.isNotEmpty(externalLoginKey)) {
>> +            if (target.contains("?")) {
>> +                result = target + "&externalLoginKey=" + 
>> externalLoginKey;
>> +            } else {
>> +                result = target + "?externalLoginKey=" + 
>> externalLoginKey;
>> +            }
>> +        }
>> +        return result;
>> +    }
>> +
>>     public void renderNextPrev(Appendable writer, Map<String, Object> 
>> context, ModelForm modelForm) throws IOException {
>>         boolean ajaxEnabled = false;
>>         List<ModelForm.UpdateArea> updateAreas = 
>> modelForm.getOnPaginateUpdateAreas();
>>
>>
> 
> 

Re: svn commit: r732083 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Posted by David E Jones <de...@me.com>.
Wouldn't it work better to append the jsessionid?

If the user hits another page (in another tab or window) after hitting  
the page the link to the popup was on then the externalLoginKey won't  
be valid any more, but a jsessionid still will be.

-David


On Jan 6, 2009, at 11:53 AM, adrianc@apache.org wrote:

> Author: adrianc
> Date: Tue Jan  6 11:53:12 2009
> New Revision: 732083
>
> URL: http://svn.apache.org/viewvc?rev=732083&view=rev
> Log:
> Fixed a bug where a login prompt appeared in lookup windows when  
> cookies are disabled - reported in https://issues.apache.org/jira/browse/OFBIZ-253 
> .
>
> Modified:
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/ 
> HtmlFormRenderer.java
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/ 
> HtmlFormRenderer.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=732083&r1=732082&r2=732083&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/ 
> HtmlFormRenderer.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/ 
> HtmlFormRenderer.java Tue Jan  6 11:53:12 2009
> @@ -2201,7 +2201,7 @@
>             writer.append(modelFormField.getParameterName(context));
>             writer.append(",'");
>         }
> -        writer.append(lookupField.getFormName(context));
> +         
> writer 
> .append(appendExternalLoginKey(lookupField.getFormName(context)));
>         writer.append("'");
>         List targetParameterList =  
> lookupField.getTargetParameterList();
>         if (targetParameterList.size() > 0) {
> @@ -2227,6 +2227,19 @@
>         //appendWhitespace(writer);
>     }
>
> +    protected String appendExternalLoginKey(String target) {
> +        String result = target;
> +        String externalLoginKey = (String)  
> this.request.getAttribute("externalLoginKey");
> +        if (UtilValidate.isNotEmpty(externalLoginKey)) {
> +            if (target.contains("?")) {
> +                result = target + "&externalLoginKey=" +  
> externalLoginKey;
> +            } else {
> +                result = target + "?externalLoginKey=" +  
> externalLoginKey;
> +            }
> +        }
> +        return result;
> +    }
> +
>     public void renderNextPrev(Appendable writer, Map<String,  
> Object> context, ModelForm modelForm) throws IOException {
>         boolean ajaxEnabled = false;
>         List<ModelForm.UpdateArea> updateAreas =  
> modelForm.getOnPaginateUpdateAreas();
>
>