svn commit: r1421651 - /ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1421651 - /ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java

jleroux@apache.org
Author: jleroux
Date: Fri Dec 14 03:27:40 2012
New Revision: 1421651

URL: http://svn.apache.org/viewvc?rev=1421651&view=rev
Log:
At Adrian and Adam's demand allow to use cache here, use default constructor
Also refactored things a bit:
* uses getPropertyAsBoolean
* set default property values

Modified:
    ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=1421651&r1=1421650&r2=1421651&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java Fri Dec 14 03:27:40 2012
@@ -64,8 +64,8 @@ public class LoginServices {
 
     public static final String module = LoginServices.class.getName();
     public static final String resource = "SecurityextUiLabels";
-    public static boolean usePasswordPattern = "true".equals(UtilProperties.getPropertyValue("security.properties", "security.login.password.pattern.enable"));
-    public static String passwordPattern = UtilProperties.getPropertyValue("security.properties", "security.login.password.pattern");
+    public boolean usePasswordPattern = UtilProperties.getPropertyAsBoolean("security.properties", "security.login.password.pattern.enable", true);
+    public String passwordPattern = UtilProperties.getPropertyValue("security.properties", "security.login.password.pattern", "^.*(?=.{5,}).*$");
 
     /** Login service to authenticate username and password
      * @return Map of results including (userLogin) GenericValue object
@@ -517,7 +517,8 @@ public class LoginServices {
             }
         }
 
-        checkNewPassword(null, null, currentPassword, currentPasswordVerify, passwordHint, errorMessageList, true, locale);
+        LoginServices loginServices = new LoginServices();  
+        loginServices.checkNewPassword(null, null, currentPassword, currentPasswordVerify, passwordHint, errorMessageList, true, locale);
 
         GenericValue userLoginToCreate = delegator.makeValue("UserLogin", UtilMisc.toMap("userLoginId", userLoginId));
         userLoginToCreate.set("externalAuthId", externalAuthId);
@@ -656,7 +657,8 @@ public class LoginServices {
 
         List<String> errorMessageList = FastList.newInstance();
         if (newPassword != null) {
-            checkNewPassword(userLoginToUpdate, currentPassword, newPassword, newPasswordVerify,
+            LoginServices loginServices = new LoginServices();  
+            loginServices.checkNewPassword(userLoginToUpdate, currentPassword, newPassword, newPasswordVerify,
                 passwordHint, errorMessageList, adminUser, locale);
         }
 
@@ -887,7 +889,7 @@ 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 void checkNewPassword(GenericValue userLogin, String currentPassword, String newPassword, String newPasswordVerify, String passwordHint, List<String> errorMessageList, boolean ignoreCurrentPassword, Locale locale) {
         boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
 
         String errMsg = null;