This is an automated email from the ASF dual-hosted git repository. jacopoc pushed a commit to branch release24.09 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit 124844ee282a99f4c557ec6b9084b47255c06048 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 (cherry picked from commit 6516157274a8c61e010e5377bd7bd056003546db) --- .../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 3d11a2c94e..c85e39fe60 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 9c6ad3679a..8c84aba2dc 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 d6e920c6a4..6f81c5a169 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 d6e920c6a4..6f81c5a169 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}"/>

