Skip to content
Permalink
Browse files

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.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1867960 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
nmalin committed Oct 4, 2019
1 parent abebcb6 commit c619dd549124f82ae105a421676b2f79e31b93e5
@@ -50,6 +50,7 @@
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 static String emailPasswordRequest(HttpServletRequest request, HttpServle
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"));
@@ -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}.
@@ -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>
@@ -494,6 +494,7 @@

MapStack<String> screenContext = MapStack.create();
screenContext.put("locale", locale);
screenContext.put("webSiteId", webSiteId);

ScreenStringRenderer screenStringRenderer = null;
try {

0 comments on commit c619dd5

Please sign in to comment.
You can’t perform that action at this time.