Author: mbrohl
Date: Tue Mar 13 20:10:31 2018 New Revision: 1826678 URL: http://svn.apache.org/viewvc?rev=1826678&view=rev Log: Improved: Extend updatePassword service API with optional parameter requirePasswordChange. (OFBIZ-10201) Thanks Martin Becker for reporting and providing the patch. Modified: ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java Modified: ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml?rev=1826678&r1=1826677&r2=1826678&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml (original) +++ ofbiz/ofbiz-framework/trunk/framework/common/servicedef/services.xml Tue Mar 13 20:10:31 2018 @@ -408,6 +408,7 @@ under the License. <attribute name="newPassword" type="String" mode="IN" optional="true"/> <attribute name="newPasswordVerify" type="String" mode="IN" optional="true"/> <attribute name="passwordHint" type="String" mode="IN" optional="true"/> + <attribute name="requirePasswordChange" type="String" mode="IN" optional="true"/> <attribute name="updatedUserLogin" type="org.apache.ofbiz.entity.GenericValue" mode="OUT" optional="false"/> </service> <service name="updateUserLoginSecurity" engine="java" default-entity-name="UserLogin" Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java?rev=1826678&r1=1826677&r2=1826678&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java Tue Mar 13 20:10:31 2018 @@ -232,12 +232,12 @@ public class LoginServices { userLogin.set("hasLoggedOut", "N"); } - // reset failed login count if necessry + // reset failed login count if necessary Long currentFailedLogins = userLogin.getLong("successiveFailedLogins"); if (currentFailedLogins != null && currentFailedLogins.longValue() > 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(); |
Free forum by Nabble | Edit this page |