This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 33ca531 Improved: correct formatting of LoginServices 33ca531 is described below commit 33ca531db450d757399ff26a7300546731be0cef Author: Jacques Le Roux <[hidden email]> AuthorDate: Tue Jul 14 14:06:18 2020 +0200 Improved: correct formatting of LoginServices This was a WIP related to "Allow single line statements in checkstyle" (OFBIZ-11886) but not really part of it. See OFBIZ-11886-format-LoginServices-checkNewPassword.patch. It may also include changes from "Checkstyle formatting issues: 'typecast' is not followed by whitespace" (OFBIZ-11887) --- .../apache/ofbiz/common/login/LoginServices.java | 193 ++++++++++++--------- 1 file changed, 109 insertions(+), 84 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java index d7948ae..2ec11c3 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java @@ -71,7 +71,9 @@ public class LoginServices { private static final String MODULE = LoginServices.class.getName(); private static final String RESOURCE = "SecurityextUiLabels"; - /** Login service to authenticate username and password + /** + * Login service to authenticate username and password + * * @return Map of results including (userLogin) GenericValue object */ public static Map<String, Object> userLogin(DispatchContext ctx, Map<String, ?> context) { @@ -96,7 +98,7 @@ public class LoginServices { } } - Map<String, Object> result = new LinkedHashMap<>(); + Map<String, Object> result = new LinkedHashMap<>(); boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security", "password.encrypt", delegator)); // if isServiceAuth is not specified, default to not a service auth @@ -150,7 +152,6 @@ public class LoginServices { Debug.logWarning(e, "", MODULE); } - // see if any external auth modules want to sync the user info if (userLogin == null) { try { @@ -190,14 +191,15 @@ public class LoginServices { userLogin = GenericValue.create(userLogin); // get the is system flag -- system accounts can only be used for service authentication - boolean isSystem = (isServiceAuth && userLogin.get("isSystem") != null) - ? "Y".equalsIgnoreCase(userLogin.getString("isSystem")) : false; + boolean isSystem = (isServiceAuth && userLogin.get("isSystem") != null) ? "Y".equalsIgnoreCase(userLogin.getString("isSystem")) + : false; // grab the hasLoggedOut flag Boolean hasLoggedOut = userLogin.getBoolean("hasLoggedOut"); - if ((UtilValidate.isEmpty(userLogin.getString("enabled")) || "Y".equals(userLogin.getString("enabled")) || - (reEnableTime != null && reEnableTime.before(UtilDateTime.nowTimestamp())) || (isSystem)) && UtilValidate.isEmpty(userLogin.getString("disabledBy"))) { + if ((UtilValidate.isEmpty(userLogin.getString("enabled")) || "Y".equals(userLogin.getString("enabled")) + || (reEnableTime != null && reEnableTime.before(UtilDateTime.nowTimestamp())) || (isSystem)) + && UtilValidate.isEmpty(userLogin.getString("disabledBy"))) { String successfulLogin; @@ -223,7 +225,7 @@ public class LoginServices { HttpServletRequest request = (javax.servlet.http.HttpServletRequest) context.get("request"); // when request is not supplied, we will treat that SSO is not required as // in the usage of userLogin service in ICalWorker.java and XmlRpcEventHandler.java. - useTomcatSSO = useTomcatSSO && (request!=null); + useTomcatSSO = useTomcatSSO && (request != null); // resolve the key for decrypt the token and control the validity boolean jwtTokenValid = SecurityUtil.authenticateUserLoginByJWT(delegator, username, jwtToken); @@ -231,8 +233,7 @@ public class LoginServices { // if the password.accept.encrypted.and.plain property in security is set to true allow plain or encrypted passwords // if this is a system account don't bother checking the passwords // if externalAuth passed; this is run as well - if ((!authFatalError && externalAuth) - || (useTomcatSSO && TomcatSSOLogin(request, username, password)) + if ((!authFatalError && externalAuth) || (useTomcatSSO && TomcatSSOLogin(request, username, password)) || (jwtToken != null && jwtTokenValid) || (password != null && checkPassword(userLogin.getString("currentPassword"), useEncryption, password))) { Debug.logVerbose("[LoginServices.userLogin] : Password Matched or Token Validated", MODULE); @@ -277,8 +278,11 @@ public class LoginServices { Debug.logInfo("[LoginServices.userLogin] : Password Incorrect", MODULE); // password invalid... - if (password != null) errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.password_incorrect", locale); - else if (jwtToken != null) errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.token_incorrect", locale); + if (password != null) { + errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.password_incorrect", locale); + } else if (jwtToken != null) { + errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.token_incorrect", locale); + } // increment failed login count Long currentFailedLogins = userLogin.getLong("successiveFailedLogins"); @@ -309,8 +313,8 @@ public class LoginServices { } // this section is being done in its own transaction rather than in the - //current/existing transaction because we may return error and we don't - //want that to stop this from getting stored + // current/existing transaction because we may return error and we don't + // want that to stop this from getting stored Transaction parentTx = null; boolean beganTransaction = false; @@ -332,13 +336,14 @@ public class LoginServices { boolean createHistory = true; // only save info on service auth if option set to true to do so - if (isServiceAuth && !"true".equals(EntityUtilProperties.getPropertyValue("security", "store.login.history.on.service.auth", delegator))) { + if (isServiceAuth && !"true".equals( + EntityUtilProperties.getPropertyValue("security", "store.login.history.on.service.auth", delegator))) { createHistory = false; } if (createHistory) { - Map<String, Object> ulhCreateMap = UtilMisc.toMap("userLoginId", username, "visitId", visitId, - "fromDate", UtilDateTime.nowTimestamp(), "successfulLogin", successfulLogin); + Map<String, Object> ulhCreateMap = UtilMisc.toMap("userLoginId", username, "visitId", visitId, "fromDate", + UtilDateTime.nowTimestamp(), "successfulLogin", successfulLogin); ModelEntity modelUserLogin = userLogin.getModelEntity(); if (modelUserLogin.isField("partyId")) { @@ -346,7 +351,8 @@ public class LoginServices { } // ONLY save the password if it was incorrect - if ("N".equals(successfulLogin) && !"false".equals(EntityUtilProperties.getPropertyValue("security", "store.login.history.incorrect.password", delegator))) { + if ("N".equals(successfulLogin) && !"false".equals(EntityUtilProperties.getPropertyValue("security", + "store.login.history.incorrect.password", delegator))) { ulhCreateMap.put("passwordUsed", password); } @@ -365,7 +371,8 @@ public class LoginServices { Debug.logError(e2, "Could not rollback nested transaction: " + e2.getMessage(), MODULE); } - // if doStore is true then this error should not be ignored and we shouldn't consider it a successful login if this happens as there is something very wrong lower down that will bite us again later + // if doStore is true then this error should not be ignored and we shouldn't consider it a successful login if this + // happens as there is something very wrong lower down that will bite us again later if (doStore) { return ServiceUtil.returnError(geeErrMsg); } @@ -396,18 +403,18 @@ public class LoginServices { continue; } - Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("username", username); - errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.account_for_user_login_id_disabled", messageMap , locale); + Map<String, Object> messageMap = UtilMisc.<String, Object> toMap("username", username); + errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.account_for_user_login_id_disabled", messageMap, locale); if (disabledDateTime != null) { - messageMap = UtilMisc.<String, Object>toMap("disabledDateTime", disabledDateTime); - errMsg += " " + UtilProperties.getMessage(RESOURCE, "loginservices.since_datetime", messageMap , locale); + messageMap = UtilMisc.<String, Object> toMap("disabledDateTime", disabledDateTime); + errMsg += " " + UtilProperties.getMessage(RESOURCE, "loginservices.since_datetime", messageMap, locale); } else { errMsg += "."; } if (loginDisableMinutes > 0 && reEnableTime != null) { - messageMap = UtilMisc.<String, Object>toMap("reEnableTime", reEnableTime); - errMsg += " " + UtilProperties.getMessage(RESOURCE, "loginservices.will_be_reenabled", messageMap , locale); + messageMap = UtilMisc.<String, Object> toMap("reEnableTime", reEnableTime); + errMsg += " " + UtilProperties.getMessage(RESOURCE, "loginservices.will_be_reenabled", messageMap, locale); } else { errMsg += " " + UtilProperties.getMessage(RESOURCE, "loginservices.not_scheduled_to_be_reenabled", locale); } @@ -429,8 +436,8 @@ public class LoginServices { userLogin.set("hasLoggedOut", "N"); result.put("userLogin", userLogin); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); - //TODO: more than this is needed to support 100% external authentication - //TODO: party + security information is needed; Userlogin will need to be stored + // TODO: more than this is needed to support 100% external authentication + // TODO: party + security information is needed; Userlogin will need to be stored } else { // userLogin record not found, user does not exist errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.user_not_found", locale); @@ -498,14 +505,14 @@ public class LoginServices { } } - //Log impersonation in UserLoginHistory + // Log impersonation in UserLoginHistory Map<String, Object> historyCreateMap = UtilMisc.toMap("userLoginId", userLoginIdToImpersonate); historyCreateMap.put("visitId", visitId); historyCreateMap.put("fromDate", UtilDateTime.nowTimestamp()); historyCreateMap.put("successfulLogin", "Y"); historyCreateMap.put("partyId", userLogin.get("partyId")); historyCreateMap.put("originUserLoginId", originUserLogin.get("userLoginId")); - //End impersonation in one hour max + // End impersonation in one hour max historyCreateMap.put("thruDate", UtilDateTime.adjustTimestamp(UtilDateTime.nowTimestamp(), Calendar.HOUR, 1)); try { delegator.create("UserLoginHistory", historyCreateMap); @@ -520,11 +527,8 @@ public class LoginServices { } /** - * Return error message if a needed control has failed : - * userLoginToImpersonate must exist - * Impersonation have to be enabled - * Check userLoginIdToImpersonate is active, not Admin and not equals to userLogin - * Check userLogin has enough permission + * Return error message if a needed control has failed : userLoginToImpersonate must exist Impersonation have to be enabled Check + * userLoginIdToImpersonate is active, not Admin and not equals to userLogin Check userLogin has enough permission * * @param delegator * @param userLogin @@ -532,7 +536,8 @@ public class LoginServices { * @param locale * @return */ - private static String checkImpersonationControls(Delegator delegator, GenericValue userLogin, GenericValue userLoginToImpersonate, Locale locale) { + private static String checkImpersonationControls(Delegator delegator, GenericValue userLogin, GenericValue userLoginToImpersonate, + Locale locale) { if (userLoginToImpersonate == null) { return UtilProperties.getMessage(RESOURCE, "loginservices.username_missing", locale); } @@ -556,7 +561,7 @@ public class LoginServices { return UtilProperties.getMessage(RESOURCE, "loginevents.impersonate_yourself", locale); } - //Cannot impersonate more privileged user + // Cannot impersonate more privileged user List<String> missingNeededPermissions = SecurityUtil.hasUserLoginMorePermissionThan(delegator, userLoginId, userLoginIdToImpersonate); if (UtilValidate.isNotEmpty(missingNeededPermissions)) { String missingPermissionListString = missingNeededPermissions.stream().collect(Collectors.joining(", ")); @@ -575,17 +580,14 @@ public class LoginServices { try { passwordChangeHistoryLimit = EntityUtilProperties.getPropertyAsInteger("security", "password.change.history.limit", 0); } catch (NumberFormatException nfe) { - //No valid value is found so don't bother to save any password history + // No valid value is found so don't bother to save any password history passwordChangeHistoryLimit = 0; } if (passwordChangeHistoryLimit == 0 || passwordChangeHistoryLimit < 0) { // Not saving password history, so return from here. return; } - EntityQuery eq = EntityQuery.use(delegator) - .from("UserLoginPasswordHistory") - .where("userLoginId", userLoginId) - .orderBy("-fromDate") + EntityQuery eq = EntityQuery.use(delegator).from("UserLoginPasswordHistory").where("userLoginId", userLoginId).orderBy("-fromDate") .cursorScrollInsensitive(); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); @@ -607,18 +609,23 @@ public class LoginServices { } // save this password in history - GenericValue userLoginPwdHistToCreate = delegator.makeValue("UserLoginPasswordHistory", UtilMisc.toMap("userLoginId", userLoginId, "fromDate", nowTimestamp)); + GenericValue userLoginPwdHistToCreate = delegator.makeValue("UserLoginPasswordHistory", + UtilMisc.toMap("userLoginId", userLoginId, "fromDate", nowTimestamp)); userLoginPwdHistToCreate.set("currentPassword", currentPassword); userLoginPwdHistToCreate.create(); } - /** Creates a UserLogin - *@param ctx The DispatchContext that this service is operating in - *@param context Map containing the input parameters - *@return Map with the result of the service, the output parameters + /** + * Creates a UserLogin + * + * @param ctx + * The DispatchContext that this service is operating in + * @param context + * Map containing the input parameters + * @return Map with the result of the service, the output parameters */ public static Map<String, Object> createUserLogin(DispatchContext ctx, Map<String, ?> context) { - Map<String, Object> result = new LinkedHashMap<>(); + Map<String, Object> result = new LinkedHashMap<>(); Delegator delegator = ctx.getDelegator(); Security security = ctx.getSecurity(); GenericValue loggedInUserLogin = (GenericValue) context.get("userLogin"); @@ -654,12 +661,14 @@ public class LoginServices { if (!partyId.equals(loggedInUserLogin.getString("partyId"))) { if (!security.hasEntityPermission("PARTYMGR", "_CREATE", loggedInUserLogin)) { - errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.party_with_specified_party_ID_exists_not_have_permission", locale); + errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.party_with_specified_party_ID_exists_not_have_permission", + locale); errorMessageList.add(errMsg); } } } else { - errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.must_be_logged_in_and_permission_create_login_party_ID_exists", locale); + errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.must_be_logged_in_and_permission_create_login_party_ID_exists", + locale); errorMessageList.add(errMsg); } } @@ -680,7 +689,8 @@ public class LoginServices { } try { - EntityCondition condition = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.EQUALS, EntityFunction.UPPER(userLoginId)); + EntityCondition condition = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.EQUALS, + EntityFunction.UPPER(userLoginId)); if (UtilValidate.isNotEmpty(EntityQuery.use(delegator).from("UserLogin").where(condition).queryList())) { Map<String, String> messageMap = UtilMisc.toMap("userLoginId", userLoginId); errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.could_not_create_login_user_with_ID_exists", messageMap, locale); @@ -710,17 +720,22 @@ public class LoginServices { return result; } - /** Updates UserLogin Password info - *@param ctx The DispatchContext that this service is operating in - *@param context Map containing the input parameters - *@return Map with the result of the service, the output parameters + /** + * Updates UserLogin Password info + * + * @param ctx + * The DispatchContext that this service is operating in + * @param context + * Map containing the input parameters + * @return Map with the result of the service, the output parameters */ public static Map<String, Object> updatePassword(DispatchContext ctx, Map<String, ?> context) { Delegator delegator = ctx.getDelegator(); Security security = ctx.getSecurity(); GenericValue loggedInUserLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); - Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "loginevents.password_was_changed_with_success", locale)); + Map<String, Object> result = ServiceUtil + .returnSuccess(UtilProperties.getMessage(RESOURCE, "loginevents.password_was_changed_with_success", locale)); // load the external auth modules -- note: this will only run once and cache the objects if (!AuthHelper.authenticatorsLoaded()) { @@ -784,10 +799,11 @@ public class LoginServices { } catch (AuthenticatorException e) { Debug.logError(e, e.getMessage(), MODULE); Map<String, String> messageMap = UtilMisc.toMap("userLoginId", userLoginId); - errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.could_not_change_password_userlogin_with_id_not_exist", messageMap, locale); + errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.could_not_change_password_userlogin_with_id_not_exist", messageMap, + locale); return ServiceUtil.returnError(errMsg); } - //result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); + // result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); result.put("updatedUserLogin", null); return result; } @@ -804,8 +820,7 @@ public class LoginServices { List<String> errorMessageList = new LinkedList<>(); if (newPassword != null) { - checkNewPassword(userLoginToUpdate, currentPassword, newPassword, newPasswordVerify, - passwordHint, errorMessageList, adminUser, locale); + checkNewPassword(userLoginToUpdate, currentPassword, newPassword, newPasswordVerify, passwordHint, errorMessageList, adminUser, locale); } if (errorMessageList.size() > 0) { @@ -826,7 +841,8 @@ public class LoginServices { } else { userLoginToUpdate.set("currentPassword", useEncryption ? HashCrypt.cryptUTF8(getHashType(), null, newPassword) : newPassword, false); userLoginToUpdate.set("passwordHint", passwordHint, false); - // optional parameter in service definition "requirePasswordChange" to update a password to a new generated value that has to be changed by the user + // 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 { @@ -843,14 +859,17 @@ public class LoginServices { return result; } - /** Updates the UserLoginId for a party, replicating password, etc from - * current login and expiring the old login. - *@param ctx The DispatchContext that this service is operating in - *@param context Map containing the input parameters - *@return Map with the result of the service, the output parameters + /** + * Updates the UserLoginId for a party, replicating password, etc from current login and expiring the old login. + * + * @param ctx + * The DispatchContext that this service is operating in + * @param context + * Map containing the input parameters + * @return Map with the result of the service, the output parameters */ public static Map<String, Object> updateUserLoginId(DispatchContext ctx, Map<String, ?> context) { - Map<String, Object> result = new LinkedHashMap<>(); + Map<String, Object> result = new LinkedHashMap<>(); Delegator delegator = ctx.getDelegator(); GenericValue loggedInUserLogin = (GenericValue) context.get("userLogin"); List<String> errorMessageList = new LinkedList<>(); @@ -948,13 +967,17 @@ public class LoginServices { return result; } - /** Updates UserLogin Security info - *@param ctx The DispatchContext that this service is operating in - *@param context Map containing the input parameters - *@return Map with the result of the service, the output parameters + /** + * Updates UserLogin Security info + * + * @param ctx + * The DispatchContext that this service is operating in + * @param context + * Map containing the input parameters + * @return Map with the result of the service, the output parameters */ public static Map<String, Object> updateUserLoginSecurity(DispatchContext ctx, Map<String, ?> context) { - Map<String, Object> result = new LinkedHashMap<>(); + Map<String, Object> result = new LinkedHashMap<>(); Delegator delegator = ctx.getDelegator(); Security security = ctx.getSecurity(); GenericValue loggedInUserLogin = (GenericValue) context.get("userLogin"); @@ -968,7 +991,8 @@ public class LoginServices { } // <b>security check</b>: must have PARTYMGR_UPDATE permission - if (!security.hasEntityPermission("PARTYMGR", "_UPDATE", loggedInUserLogin) && !security.hasEntityPermission("SECURITY", "_UPDATE", loggedInUserLogin)) { + if (!security.hasEntityPermission("PARTYMGR", "_UPDATE", loggedInUserLogin) + && !security.hasEntityPermission("SECURITY", "_UPDATE", loggedInUserLogin)) { errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.not_permission_update_security_info_for_user_login", locale); return ServiceUtil.returnError(errMsg); } @@ -1032,7 +1056,8 @@ public class LoginServices { return result; } - public static void checkNewPassword(GenericValue userLogin, String currentPassword, String newPassword, String newPasswordVerify, String passwordHint, List<String> errorMessageList, boolean ignoreCurrentPassword, Locale locale) { + public static void checkNewPassword(GenericValue userLogin, String currentPassword, String newPassword, String newPasswordVerify, + String passwordHint, List<String> errorMessageList, boolean ignoreCurrentPassword, Locale locale) { Delegator delegator = userLogin.getDelegator(); boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security", "password.encrypt", delegator)); @@ -1065,22 +1090,20 @@ public class LoginServices { try { passwordChangeHistoryLimit = EntityUtilProperties.getPropertyAsInteger("security", "password.change.history.limit", 0); } catch (NumberFormatException nfe) { - //No valid value is found so don't bother to save any password history + // No valid value is found so don't bother to save any password history passwordChangeHistoryLimit = 0; } Debug.logInfo(" password.change.history.limit is set to " + passwordChangeHistoryLimit, MODULE); if (passwordChangeHistoryLimit > 0) { Debug.logInfo(" checkNewPassword Checking if user is tyring to use old password " + passwordChangeHistoryLimit, MODULE); try { - List<GenericValue> pwdHistList = EntityQuery.use(delegator) - .from("UserLoginPasswordHistory") - .where("userLoginId", userLogin.getString("userLoginId")) - .orderBy("-fromDate") - .queryList(); + List<GenericValue> pwdHistList = EntityQuery.use(delegator).from("UserLoginPasswordHistory") + .where("userLoginId", userLogin.getString("userLoginId")).orderBy("-fromDate").queryList(); for (GenericValue pwdHistValue : pwdHistList) { if (checkPassword(pwdHistValue.getString("currentPassword"), useEncryption, newPassword)) { Map<String, Integer> messageMap = UtilMisc.toMap("passwordChangeHistoryLimit", passwordChangeHistoryLimit); - errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.password_must_be_different_from_last_passwords", messageMap, locale); + errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.password_must_be_different_from_last_passwords", messageMap, + locale); errorMessageList.add(errMsg); break; } @@ -1101,7 +1124,8 @@ public class LoginServices { if (newPassword != null) { // Matching password with pattern - String passwordPattern = EntityUtilProperties.getPropertyValue("security", "security.login.password.pattern", "^.*(?=.{5,}).*$", delegator); + String passwordPattern = EntityUtilProperties.getPropertyValue("security", "security.login.password.pattern", "^.*(?=.{5,}).*$", + delegator); boolean usePasswordPattern = UtilProperties.getPropertyAsBoolean("security", "security.login.password.pattern.enable", true); if (usePasswordPattern) { Pattern pattern = Pattern.compile(passwordPattern); @@ -1110,8 +1134,8 @@ public class LoginServices { if (!matched) { // This is a mix to handle the OOTB pattern which is only a fixed length Map<String, String> messageMap = UtilMisc.toMap("minPasswordLength", Integer.toString(minPasswordLength)); - String passwordPatternMessage = EntityUtilProperties.getPropertyValue("security", - "security.login.password.pattern.description", "loginservices.password_must_be_least_characters_long", delegator); + String passwordPatternMessage = EntityUtilProperties.getPropertyValue("security", "security.login.password.pattern.description", + "loginservices.password_must_be_least_characters_long", delegator); errMsg = UtilProperties.getMessage(RESOURCE, passwordPatternMessage, messageMap, locale); errorMessageList.add(errMsg); } @@ -1126,7 +1150,8 @@ public class LoginServices { errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.password_may_not_equal_username", locale); errorMessageList.add(errMsg); } - if (UtilValidate.isNotEmpty(passwordHint) && (passwordHint.toUpperCase(Locale.getDefault()).indexOf(newPassword.toUpperCase(Locale.getDefault())) >= 0)) { + if (UtilValidate.isNotEmpty(passwordHint) + && (passwordHint.toUpperCase(Locale.getDefault()).indexOf(newPassword.toUpperCase(Locale.getDefault())) >= 0)) { errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.password_hint_may_not_contain_password", locale); errorMessageList.add(errMsg); } |
Free forum by Nabble | Edit this page |