You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2019/10/04 07:32:49 UTC

svn commit: r1867960 - in /ofbiz/ofbiz-framework/trunk: applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/ applications/securityext/template/email/ applications/securityext/widget/ framework/common/src/main/java/org/apache/ofbiz...

Author: nmalin
Date: Fri Oct  4 07:32:48 2019
New Revision: 1867960

URL: http://svn.apache.org/viewvc?rev=1867960&view=rev
Log:
Improved: Use website to generate links on email content
(OFBIZ-4361)
OFBiz contains a nice process to generate link through WebSite entity.
Unfortunately when you send an email, the standard service didn't propage the website 
to the body content email, so we can't use it.

This improvement is needed on forgot password process to resolve the correct uri 
and go back on good OFBiz component: where the user requested for a new password.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java
    ofbiz/ofbiz-framework/trunk/applications/securityext/template/email/PasswordEmail.ftl
    ofbiz/ofbiz-framework/trunk/applications/securityext/widget/EmailSecurityScreens.xml
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java

Modified: ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java?rev=1867960&r1=1867959&r2=1867960&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java Fri Oct  4 07:32:48 2019
@@ -50,6 +50,7 @@ import org.apache.ofbiz.service.LocalDis
 import org.apache.ofbiz.service.ModelService;
 import org.apache.ofbiz.service.ServiceUtil;
 import org.apache.ofbiz.webapp.control.LoginWorker;
+import org.apache.ofbiz.webapp.website.WebSiteWorker;
 
 /**
  * LoginEvents - Events for UserLogin and Security handling.
@@ -286,6 +287,7 @@ public class LoginEvents {
             Map<String, Object> serviceContext = new HashMap<>();
             serviceContext.put("bodyScreenUri", bodyScreenLocation);
             serviceContext.put("bodyParameters", bodyParameters);
+            serviceContext.put("webSiteId", WebSiteWorker.getWebSiteId(request));
             if (productStoreEmail != null) {
                 serviceContext.put("subject", productStoreEmail.getString("subject"));
                 serviceContext.put("sendFrom", productStoreEmail.get("fromAddress"));

Modified: ofbiz/ofbiz-framework/trunk/applications/securityext/template/email/PasswordEmail.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/securityext/template/email/PasswordEmail.ftl?rev=1867960&r1=1867959&r2=1867960&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/securityext/template/email/PasswordEmail.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/securityext/template/email/PasswordEmail.ftl Fri Oct  4 07:32:48 2019
@@ -26,7 +26,7 @@ under the License.
   
   <br />
   <div>
-      <form method="post" action="${baseEcommerceSecureUrl}/partymgr/control/passwordChange?USERNAME=${userLogin.userLoginId!}&TOKEN=${token!}&forgotPwdFlag=true&tenantId=${tenantId!}" name="loginform" id="loginform" target="_blank">
+      <form method="post" action="<@ofbizUrl fullPath="true" secure="true" webSiteId="${webSiteId!}">passwordChange</...@ofbizUrl>?USERNAME=${userLogin.userLoginId!}&TOKEN=${token!}&forgotPwdFlag=true&tenantId=${tenantId!}" name="loginform" id="loginform" target="_blank">
         <input type="submit" name="submit" value="${uiLabelMap.ResetPassword}" />
       </form>
       ${uiLabelMap.SecurityExtLinkOnce}.

Modified: ofbiz/ofbiz-framework/trunk/applications/securityext/widget/EmailSecurityScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/securityext/widget/EmailSecurityScreens.xml?rev=1867960&r1=1867959&r2=1867960&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/securityext/widget/EmailSecurityScreens.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/securityext/widget/EmailSecurityScreens.xml Fri Oct  4 07:32:48 2019
@@ -26,7 +26,6 @@ under the License.
             <actions>
                 <property-map resource="EmailPasswordUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="SecurityUiLabels" map-name="uiLabelMap" global="true"/>
-                <set field="baseEcommerceSecureUrl" value="${baseSecureUrl}"/>
             </actions>
             <widgets>
                 <platform-specific><html><html-template location="component://securityext/template/email/PasswordEmail.ftl"/></html></platform-specific>

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java?rev=1867960&r1=1867959&r2=1867960&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java Fri Oct  4 07:32:48 2019
@@ -494,6 +494,7 @@ public class EmailServices {
 
         MapStack<String> screenContext = MapStack.create();
         screenContext.put("locale", locale);
+        screenContext.put("webSiteId", webSiteId);
 
         ScreenStringRenderer screenStringRenderer = null;
         try {