From 0cb4f4af16565bb067d68bc3eb26c64e690a0881 Mon Sep 17 00:00:00 2001 From: Michael Brohl Date: Tue, 13 Mar 2018 20:10:31 +0000 Subject: [PATCH] Improved: Extend updatePassword service API with optional parameter requirePasswordChange. (OFBIZ-10201) Thanks Martin Becker for reporting and providing the patch. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1826678 13f79535-47bb-0310-9956-ffa450edef68 --- framework/common/servicedef/services.xml | 1 + .../java/org/apache/ofbiz/common/login/LoginServices.java | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/framework/common/servicedef/services.xml b/framework/common/servicedef/services.xml index ffc9ff4b9e..409a1396f3 100644 --- a/framework/common/servicedef/services.xml +++ b/framework/common/servicedef/services.xml @@ -408,6 +408,7 @@ under the License. + 0) { userLogin.set("successiveFailedLogins", Long.valueOf(0)); } else if (!hasLoggedOut) { - // successful login & no loggout flag, no need to change anything, so don't do the store + // successful login & no logout flag, no need to change anything, so don't do the store doStore = false; } @@ -709,7 +709,8 @@ public class LoginServices { } else { userLoginToUpdate.set("currentPassword", useEncryption ? HashCrypt.cryptUTF8(getHashType(), null, newPassword) : newPassword, false); userLoginToUpdate.set("passwordHint", passwordHint, false); - userLoginToUpdate.set("requirePasswordChange", "N"); + // optional parameter in service definition "requirePasswordChange" to update a password to a new generated value that has to be changed by the user + userLoginToUpdate.set("requirePasswordChange", ("Y".equals(context.get("requirePasswordChange")) ? "Y" : "N")); try { userLoginToUpdate.store();