diff --git a/applications/accounting/webapp/accounting/WEB-INF/controller.xml b/applications/accounting/webapp/accounting/WEB-INF/controller.xml index d56e9bd94b..2a892faf88 100644 --- a/applications/accounting/webapp/accounting/WEB-INF/controller.xml +++ b/applications/accounting/webapp/accounting/WEB-INF/controller.xml @@ -60,6 +60,7 @@ under the License. + @@ -1366,7 +1367,8 @@ under the License. - + + diff --git a/applications/accounting/widget/CommonScreens.xml b/applications/accounting/widget/CommonScreens.xml index d9c869045e..e366316e14 100644 --- a/applications/accounting/widget/CommonScreens.xml +++ b/applications/accounting/widget/CommonScreens.xml @@ -320,4 +320,17 @@ under the License. + +
+ + + + + + + + + +
+
diff --git a/applications/content/webapp/content/WEB-INF/controller.xml b/applications/content/webapp/content/WEB-INF/controller.xml index 26386c214f..7cec2f3c5c 100644 --- a/applications/content/webapp/content/WEB-INF/controller.xml +++ b/applications/content/webapp/content/WEB-INF/controller.xml @@ -58,7 +58,8 @@ under the License. - + + @@ -1680,6 +1681,7 @@ under the License. + diff --git a/applications/content/widget/CommonScreens.xml b/applications/content/widget/CommonScreens.xml index fdb42f0f02..d308ff761f 100644 --- a/applications/content/widget/CommonScreens.xml +++ b/applications/content/widget/CommonScreens.xml @@ -317,6 +317,19 @@ under the License. + +
+ + + + + + + + + +
+
diff --git a/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml b/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml index 0cb0dd8a05..7fcc036df5 100644 --- a/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml +++ b/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml @@ -86,6 +86,7 @@ under the License. + @@ -1557,6 +1558,7 @@ under the License. + diff --git a/applications/ecommerce/webapp/ecommerce/requirePasswordChange.ftl b/applications/ecommerce/webapp/ecommerce/requirePasswordChange.ftl new file mode 100644 index 0000000000..faa2cdfc92 --- /dev/null +++ b/applications/ecommerce/webapp/ecommerce/requirePasswordChange.ftl @@ -0,0 +1,68 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#assign username = ""/> +<#if requestParameters.USERNAME?has_content> + <#assign username = requestParameters.USERNAME/> +<#elseif autoUserLogin?has_content> + <#assign username = autoUserLogin.userLoginId/> + + +
${uiLabelMap.CommonLogin}
+
+ +
+
+
${uiLabelMap.CommonRegistered}
+
+
+
+ + +
+ ${uiLabelMap.CommonUsername}: ${username} +
+ <#if autoUserLogin?has_content> +
+ (${uiLabelMap.CommonNot} ${autoUserLogin.userLoginId}? ${uiLabelMap.CommonClickHere}) +
+ +
+ ${uiLabelMap.CommonPassword}:  + +
+
+ ${uiLabelMap.CommonNewPassword}:  + +
+
+ ${uiLabelMap.CommonNewPasswordVerify}:  + +
+
+ +
+
+
+
+ + diff --git a/applications/ecommerce/widget/CommonScreens.xml b/applications/ecommerce/widget/CommonScreens.xml index 39fdf33160..c54e2652af 100644 --- a/applications/ecommerce/widget/CommonScreens.xml +++ b/applications/ecommerce/widget/CommonScreens.xml @@ -244,6 +244,24 @@ under the License.
+ +
+ + + + diff --git a/framework/example/webapp/example/WEB-INF/controller.xml b/framework/example/webapp/example/WEB-INF/controller.xml index 65b833be2f..dce610275e 100644 --- a/framework/example/webapp/example/WEB-INF/controller.xml +++ b/framework/example/webapp/example/WEB-INF/controller.xml @@ -65,6 +65,7 @@ under the License. + @@ -185,6 +186,7 @@ under the License. + diff --git a/framework/example/widget/example/CommonScreens.xml b/framework/example/widget/example/CommonScreens.xml index 641157e7b9..858b2cda84 100644 --- a/framework/example/widget/example/CommonScreens.xml +++ b/framework/example/widget/example/CommonScreens.xml @@ -162,4 +162,17 @@ under the License.
+ +
+ + + + + + + + + +
+
diff --git a/framework/security/entitydef/entitymodel.xml b/framework/security/entitydef/entitymodel.xml index 27ab87f191..6e8efefa75 100644 --- a/framework/security/entitydef/entitymodel.xml +++ b/framework/security/entitydef/entitymodel.xml @@ -69,6 +69,7 @@ under the License. + diff --git a/framework/shark/webapp/shark/WEB-INF/controller.xml b/framework/shark/webapp/shark/WEB-INF/controller.xml index c82666253b..ff3ffeca19 100644 --- a/framework/shark/webapp/shark/WEB-INF/controller.xml +++ b/framework/shark/webapp/shark/WEB-INF/controller.xml @@ -59,6 +59,7 @@ under the License. + @@ -124,6 +125,7 @@ under the License. + diff --git a/framework/shark/widget/CommonScreens.xml b/framework/shark/widget/CommonScreens.xml index bc8c242432..50d52ebba4 100644 --- a/framework/shark/widget/CommonScreens.xml +++ b/framework/shark/widget/CommonScreens.xml @@ -71,4 +71,17 @@ under the License. + +
+ + + + + + + + + +
+
diff --git a/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java b/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java index 528c97d2e5..dc7924c4fe 100644 --- a/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java +++ b/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java @@ -51,6 +51,7 @@ import org.ofbiz.security.Security; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; +import org.ofbiz.service.ServiceUtil; import org.ofbiz.webapp.stats.VisitHandler; import org.ofbiz.common.login.LoginServices; @@ -303,11 +304,37 @@ public class LoginWorker { password = password.toLowerCase(); } + String requirePasswordChange = request.getParameter("requirePasswordChange"); + // get the visit id to pass to the userLogin for history String visitId = VisitHandler.getVisitId(session); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Map result = null; + if (UtilValidate.isNotEmpty(requirePasswordChange) && "Y".equals(requirePasswordChange)) { + Map inMap = UtilMisc.toMap("login.username", username, "login.password", password, "locale", UtilHttp.getLocale(request)); + inMap.put("userLoginId", username); + inMap.put("currentPassword", password); + inMap.put("newPassword", request.getParameter("newPassword")); + inMap.put("newPasswordVerify", request.getParameter("newPasswordVerify")); + try { + result = dispatcher.runSync("updatePassword", inMap); + } catch (GenericServiceException e) { + Debug.logError(e, "Error calling updatePassword service", module); + Map messageMap = UtilMisc.toMap("errorMessage", e.getMessage()); + String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.following_error_occurred_during_login", messageMap, UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + if (ServiceUtil.isError(result)) { + Map messageMap = UtilMisc.toMap("errorMessage", (String) result.get(ModelService.ERROR_MESSAGE)); + String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.following_error_occurred_during_login", messageMap, UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } else { + password = request.getParameter("newPassword"); + } + } try { result = dispatcher.runSync("userLogin", UtilMisc.toMap("login.username", username, "login.password", password, "visitId", visitId, "locale", UtilHttp.getLocale(request))); @@ -322,6 +349,9 @@ public class LoginWorker { if (ModelService.RESPOND_SUCCESS.equals(result.get(ModelService.RESPONSE_MESSAGE))) { GenericValue userLogin = (GenericValue) result.get("userLogin"); Map userLoginSession = (Map) result.get("userLoginSession"); + if (userLogin != null && "Y".equals(userLogin.getString("requirePasswordChange"))) { + return "requirePasswordChange"; + } return doMainLogin(request, response, userLogin, userLoginSession); } else { Map messageMap = UtilMisc.toMap("errorMessage", (String) result.get(ModelService.ERROR_MESSAGE)); diff --git a/framework/webtools/webapp/webtools/WEB-INF/controller.xml b/framework/webtools/webapp/webtools/WEB-INF/controller.xml index 50d4dc55f8..7c53a5984e 100644 --- a/framework/webtools/webapp/webtools/WEB-INF/controller.xml +++ b/framework/webtools/webapp/webtools/WEB-INF/controller.xml @@ -62,6 +62,7 @@ under the License. + @@ -551,6 +552,7 @@ under the License. + diff --git a/framework/webtools/widget/CommonScreens.xml b/framework/webtools/widget/CommonScreens.xml index 26b27149b8..d20f1add71 100644 --- a/framework/webtools/widget/CommonScreens.xml +++ b/framework/webtools/widget/CommonScreens.xml @@ -74,6 +74,19 @@ under the License. + +
+ + + + + + + + + +
+
diff --git a/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml b/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml index d1a6dbdc66..01293290bc 100644 --- a/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml +++ b/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/controller.xml @@ -179,6 +179,7 @@ + diff --git a/specialpurpose/assetmaint/widget/CommonScreens.xml b/specialpurpose/assetmaint/widget/CommonScreens.xml index ebac9899c6..f6f7014dea 100644 --- a/specialpurpose/assetmaint/widget/CommonScreens.xml +++ b/specialpurpose/assetmaint/widget/CommonScreens.xml @@ -73,6 +73,19 @@
+ +
+ + + + + + + + + +
+
diff --git a/specialpurpose/cmssite/webapp/cmssite/WEB-INF/controller.xml b/specialpurpose/cmssite/webapp/cmssite/WEB-INF/controller.xml index 24ed39a57e..0a90ba892e 100644 --- a/specialpurpose/cmssite/webapp/cmssite/WEB-INF/controller.xml +++ b/specialpurpose/cmssite/webapp/cmssite/WEB-INF/controller.xml @@ -76,6 +76,7 @@ under the License. + diff --git a/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/controller.xml b/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/controller.xml index a769148e36..78e8570a16 100644 --- a/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/controller.xml +++ b/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/controller.xml @@ -62,6 +62,7 @@ under the License. + diff --git a/specialpurpose/oagis/webapp/oagis/WEB-INF/controller.xml b/specialpurpose/oagis/webapp/oagis/WEB-INF/controller.xml index bc6057e0a6..2521e32260 100644 --- a/specialpurpose/oagis/webapp/oagis/WEB-INF/controller.xml +++ b/specialpurpose/oagis/webapp/oagis/WEB-INF/controller.xml @@ -65,6 +65,7 @@ + @@ -85,6 +86,7 @@ + diff --git a/specialpurpose/oagis/widget/CommonScreens.xml b/specialpurpose/oagis/widget/CommonScreens.xml index 2100c047e6..411bc49e27 100644 --- a/specialpurpose/oagis/widget/CommonScreens.xml +++ b/specialpurpose/oagis/widget/CommonScreens.xml @@ -57,6 +57,19 @@
+ +
+ + + + + + + + + +
+
diff --git a/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml b/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml index 55e125946f..dd8bd6fbe4 100644 --- a/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml +++ b/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml @@ -42,7 +42,8 @@ - + + diff --git a/specialpurpose/projectmgr/widget/CommonScreens.xml b/specialpurpose/projectmgr/widget/CommonScreens.xml index 55bc520607..d9edabc607 100644 --- a/specialpurpose/projectmgr/widget/CommonScreens.xml +++ b/specialpurpose/projectmgr/widget/CommonScreens.xml @@ -66,6 +66,19 @@
+ +
+ + + + + + + + + +
+