From 986aa62ed00bee39363bab41b4eeb8259d446efd Mon Sep 17 00:00:00 2001
From: ludc <ludc@vci-tech.com>
Date: 星期四, 16 一月 2025 18:20:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/Client/PLTClient/src/com/vci/client/logon/base/LogonHandler.java |   73 +++++++++++++++++++++++++++---------
 1 files changed, 54 insertions(+), 19 deletions(-)

diff --git a/Source/Client/PLTClient/src/com/vci/client/logon/base/LogonHandler.java b/Source/Client/PLTClient/src/com/vci/client/logon/base/LogonHandler.java
index 0a66579..af36b79 100644
--- a/Source/Client/PLTClient/src/com/vci/client/logon/base/LogonHandler.java
+++ b/Source/Client/PLTClient/src/com/vci/client/logon/base/LogonHandler.java
@@ -22,6 +22,7 @@
 import com.vci.client.framework.util.RightControlUtil;
 import com.vci.client.ui.exception.VCIException;
 import com.vci.client.ui.locale.LocaleDisplay;
+import com.vci.client.ui.swing.VCIOptionPane;
 import com.vci.corba.common.VCIError;
 import com.vci.corba.framework.data.DataSourceInfo;
 import com.vci.mw.ClientContextVariable;
@@ -239,24 +240,6 @@
 			return res;
 		}
 		
-		int actualType = 0;
-		int mimacelue = pwdStgObj.getRequiredType();
-		//鍒ゆ柇瀵嗙爜灞炰簬鍝瀵嗙爜绛栫暐
-		CombinationObject[] combinationObjs = rmcd.fetchCombinationsByPstId(pwdStgObj.getId());
-		for (CombinationObject combObj : combinationObjs){
-			List<String> list = new ArrayList<String>();
-			CombinationValueObject[] combValObj = rmcd.fetchCombinationValuesByParentId(combObj.getId());
-			for (CombinationValueObject obj : combValObj){
-				list.add(obj.getValue());
-			}
-			for (int i = 0 ; i < userObj.getPwd().length() ;i ++){
-				String a = ""+userObj.getPwd().charAt(i);
-				if (list.contains(a)){
-					actualType +=1 ;
-					break;
-				}
-			}
-		}
 		
 		if (!("".equals(pwdStgObj.getId()))) {// 瀵嗙爜绛栫暐鏄惁涓虹┖
 			defaultWrongNum = pwdStgObj.getRetryTime(); // 鑾峰彇瀵嗙爜绛栫暐瑙勫畾鐨勯敊璇櫥褰曟鏁�
@@ -264,6 +247,57 @@
 			dafaultOverdueDay = pwdStgObj.getOverdueDay(); // 鑾峰彇瀵嗙爜瑙勫垯鐨勮繃鏈熷ぉ鏁�
 			dafaultRemideDay = pwdStgObj.getRemideDay(); // 鑾峰彇瀵嗙爜绛栫暐瑙勫畾鐨勫瘑鐮佸揩杩囨湡鎻愰啋澶╂暟锛堟彁鍓峹x澶╁紑濮嬫彁閱掕淇敼瀵嗙爜锛�
 		}
+		
+		String password = userObj.getPwd();
+		int requiredType = pwdStgObj.getRequiredType(); // 蹇呭~绉嶇被
+		int containsTypes = pwdStgObj.getCharTypes();// 鍖呭惈瀛楃绫诲瀷
+		
+		//鍒ゆ柇瀵嗙爜灞炰簬鍝瀵嗙爜绛栫暐
+//		CombinationObject[] combinationObjs = rmcd.fetchCombinationsByPstId(pwdStgObj.getId());
+//		for (CombinationObject combObj : combinationObjs){
+//			List<String> list = new ArrayList<String>();
+//			CombinationValueObject[] combValObj = rmcd.fetchCombinationValuesByParentId(combObj.getId());
+//			for (CombinationValueObject obj : combValObj){
+//				list.add(obj.getValue());
+//			}
+//			for (int i = 0 ; i < userObj.getPwd().length() ;i ++){
+//				String a = ""+userObj.getPwd().charAt(i);
+//				if (list.contains(a)){
+//					actualType +=1 ;
+//					break;
+//				}
+//			}
+//		}
+		int actualTypes = 0;
+		int typeCount = 0;
+		{
+			
+            String symbol = "[ _`~!@#$%^&*()-+={[}]|\\'\":;,.<>/?";
+			
+			for (int i = 0 ; i < password.length() ;i ++){
+				char c = password.charAt(i);
+				if (Character.isDigit(c))
+					actualTypes |= 0x01;
+				else if (Character.isLowerCase(c))
+					actualTypes |= 0x02;
+				else if (Character.isUpperCase(c))
+					actualTypes |= 0x04;
+				else if (symbol.indexOf(c) > -1)
+					actualTypes |= 0x08;
+			}
+			
+			for (int i = 0; i < 4; i++) {
+				int type = (int)Math.pow(2, i);
+				if ((actualTypes & type) == type)
+					typeCount++;
+			}
+			
+			if ((actualTypes & containsTypes) != actualTypes || typeCount < requiredType){
+				res.setOtherMessage(getThisI18n("userPwdStagIsUpdatePleaseChange"));
+				res.setNeedChangePassword(true);
+			}
+		}
+
 		
 		long pwdUpdateTime = userObj.getPwdUpdateTime();
 		long systemTime = rmcd.getSystemTime();
@@ -277,7 +311,8 @@
 			// 鎮ㄧ殑瀵嗙爜宸茬粡杩囨湡,璇疯繘琛屼慨鏀癸紒
 			res.setOtherMessage(getThisI18n("userPwdIsExpiredPleaseChange"));
 			res.setNeedChangePassword(true);
-		} else if (actualType < mimacelue) {
+		//} else if (actualType < mimacelue) {
+		} else if ((actualTypes & containsTypes) != actualTypes || typeCount < requiredType){
 			// 鎮ㄧ殑瀵嗙爜绛栫暐宸茬粡淇敼锛岄渶瑕佷慨鏀瑰瘑鐮佹墠鑳借繘琛屽叾瀹冩搷浣�!
 			res.setOtherMessage(getThisI18n("userPwdStagIsUpdatePleaseChange"));
 			res.setNeedChangePassword(true);

--
Gitblit v1.9.3