This is an automated email from the ASF dual-hosted git repository.

jacopoc pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 6516157274a8c61e010e5377bd7bd056003546db
Author: Jacopo Cappellato <[email protected]>
AuthorDate: Tue May 12 12:48:53 2026 +0200

    Fixed: Remove unnecessary requirePasswordChange parameter from 
ChangePassword forms and adjust login workflow accordingly
---
 .../java/org/apache/ofbiz/webapp/control/LoginWorker.java  | 14 +++++++-------
 themes/common-theme/template/ChangePassword.ftl            |  1 -
 themes/helveticus/template/ChangePassword.ftl              |  1 -
 themes/rainbowstone/template/ChangePassword.ftl            |  1 -
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
index 5f8a15eccd..4f0326a63f 100644
--- 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
+++ 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java
@@ -444,10 +444,9 @@ public final class LoginWorker {
         if (UtilValidate.isEmpty(password) && UtilValidate.isEmpty(token)) {
             unpwErrMsgList.add(UtilProperties.getMessage(RESOURCE, 
"loginevents.password_was_empty_reenter", UtilHttp.getLocale(request)));
         }
-        boolean requirePasswordChange = 
"Y".equals(request.getParameter("requirePasswordChange"));
         if (!unpwErrMsgList.isEmpty()) {
             request.setAttribute("_ERROR_MESSAGE_LIST_", unpwErrMsgList);
-            return requirePasswordChange ? "requirePasswordChange" : "error";
+            return "error";
         }
 
         boolean setupNewDelegatorEtc = false;
@@ -535,8 +534,9 @@ public final class LoginWorker {
 
         if 
(ModelService.RESPOND_SUCCESS.equals(result.get(ModelService.RESPONSE_MESSAGE)))
 {
             GenericValue userLogin = (GenericValue) result.get("userLogin");
-
-            if (requirePasswordChange) {
+            if (userLogin != null && 
"Y".equals(userLogin.getString("requirePasswordChange"))
+                    && 
UtilValidate.isNotEmpty(request.getParameter("newPassword"))
+                    && 
UtilValidate.isNotEmpty(request.getParameter("newPasswordVerify"))) {
                 Map<String, Object> inMap = UtilMisc.<String, Object>toMap(
                         "login.username", username,
                         "login.password", password,
@@ -554,7 +554,7 @@ public final class LoginWorker {
                     String errMsg = UtilProperties.getMessage(RESOURCE, 
"loginevents.following_error_occurred_during_login",
                             messageMap, UtilHttp.getLocale(request));
                     request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                    return "requirePasswordChange";
+                    return "error";
                 }
                 if (ServiceUtil.isError(resultPasswordChange)) {
                     String errorMessage = (String) 
resultPasswordChange.get(ModelService.ERROR_MESSAGE);
@@ -565,7 +565,7 @@ public final class LoginWorker {
                         request.setAttribute("_ERROR_MESSAGE_", errMsg);
                     }
                     request.setAttribute("_ERROR_MESSAGE_LIST_", 
resultPasswordChange.get(ModelService.ERROR_MESSAGE_LIST));
-                    return "requirePasswordChange";
+                    return "error";
                 } else {
                     try {
                         userLogin.refresh();
@@ -575,7 +575,7 @@ public final class LoginWorker {
                         String errMsg = UtilProperties.getMessage(RESOURCE, 
"loginevents.following_error_occurred_during_login",
                                 messageMap, UtilHttp.getLocale(request));
                         request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                        return "requirePasswordChange";
+                        return "error";
                     }
                 }
             }
diff --git a/themes/common-theme/template/ChangePassword.ftl 
b/themes/common-theme/template/ChangePassword.ftl
index 5c11996dd5..5a99d0baa4 100644
--- a/themes/common-theme/template/ChangePassword.ftl
+++ b/themes/common-theme/template/ChangePassword.ftl
@@ -29,7 +29,6 @@ under the License.
   </div>
   <div class="screenlet-body">
     <form method="post" action="<@ofbizUrl>login</@ofbizUrl>" name="loginform">
-      <input type="hidden" name="requirePasswordChange" value="Y"/>
       <input type="hidden" name="USERNAME" value="${username}"/>
       <input type="hidden" name="TOKEN" value="${parameters.TOKEN!}"/>
       <input type="hidden" name="userTenantId" value="${tenantId}"/>
diff --git a/themes/helveticus/template/ChangePassword.ftl 
b/themes/helveticus/template/ChangePassword.ftl
index 9a0426c77c..11dc9c90ee 100644
--- a/themes/helveticus/template/ChangePassword.ftl
+++ b/themes/helveticus/template/ChangePassword.ftl
@@ -29,7 +29,6 @@ under the License.
   </div>
   <div class="screenlet-body">
     <form method="post" action="<@ofbizUrl>login</@ofbizUrl>" name="loginform">
-      <input type="hidden" name="requirePasswordChange" value="Y"/>
       <input type="hidden" name="USERNAME" value="${username}"/>
       <input type="hidden" name="TOKEN" value="${parameters.TOKEN!}"/>
       <input type="hidden" name="userTenantId" value="${tenantId}"/>
diff --git a/themes/rainbowstone/template/ChangePassword.ftl 
b/themes/rainbowstone/template/ChangePassword.ftl
index 9a0426c77c..11dc9c90ee 100644
--- a/themes/rainbowstone/template/ChangePassword.ftl
+++ b/themes/rainbowstone/template/ChangePassword.ftl
@@ -29,7 +29,6 @@ under the License.
   </div>
   <div class="screenlet-body">
     <form method="post" action="<@ofbizUrl>login</@ofbizUrl>" name="loginform">
-      <input type="hidden" name="requirePasswordChange" value="Y"/>
       <input type="hidden" name="USERNAME" value="${username}"/>
       <input type="hidden" name="TOKEN" value="${parameters.TOKEN!}"/>
       <input type="hidden" name="userTenantId" value="${tenantId}"/>

Reply via email to