This is an automated email from the ASF dual-hosted git repository.

hefengen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new d4c1c32a7 fix password rules, add special characters '#' and '.' 
(#4977)
d4c1c32a7 is described below

commit d4c1c32a7b0dc64e32a56e74dee68fe823d645ba
Author: liusishan <[email protected]>
AuthorDate: Tue Aug 15 10:32:27 2023 +0800

    fix password rules, add special characters '#' and '.' (#4977)
    
    Co-authored-by: liusishan <[email protected]>
    Co-authored-by: likeguo <[email protected]>
---
 .../shenyu/admin/model/constant/RegConstant.java   | 24 +++++++++++-----------
 .../controller/DashboardUserControllerTest.java    | 16 +++++++--------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/constant/RegConstant.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/constant/RegConstant.java
index 848e8fe86..18e975314 100644
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/constant/RegConstant.java
+++ 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/constant/RegConstant.java
@@ -21,35 +21,35 @@ package org.apache.shenyu.admin.model.constant;
  * RegConstant.
  */
 public final class RegConstant {
-    
+
     /**
      * Minimum length of 8, including upper and lower case letters, numbers 
and special characters.
      */
-    public static final String PASSWORD_RULE = 
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&=_+-])[A-Za-z\\d@$!%*?&=_+-]{8,}$";
-    
-    
+    public static final String PASSWORD_RULE = 
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&#.=_+-])[A-Za-z\\d@$!%*?&#.=_+-]{8,}$";
+
+
     /**
      * At least 8 in length, containing at least one letter and one number.
      */
     public static final String PASSWORD_RULE_L0 = 
"^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$";
-    
+
     /**
      * Minimum length of 8, containing at least one letter and one number and 
one special character.
      */
-    public static final String PASSWORD_RULE_L1 = 
"^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{8,}$";
-    
+    public static final String PASSWORD_RULE_L1 = 
"^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*?&#.=_+-])[A-Za-z\\d@$!%*?&#.=_+-]{8,}$";
+
     /**
      * At least 8 in length, with at least one number and both upper and lower 
case letters.
      */
     public static final String PASSWORD_RULE_L2 = 
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{8,}$";
-    
+
     /**
      * Minimum length of 8 - 16, including upper and lower case letters, 
numbers and special characters.
      */
-    public static final String PASSWORD_RULE_L3 = 
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,16}$";
-    
+    public static final String PASSWORD_RULE_L3 = 
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\)(?=.*[@$!%*?&#.=_+-])[A-Za-z\\d@$!%*?&#.=_+-]{8,16}$";
+
     private RegConstant() {
-    
+
     }
-    
+
 }
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/DashboardUserControllerTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/DashboardUserControllerTest.java
index b1ffe4b90..9149bc9fd 100644
--- 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/DashboardUserControllerTest.java
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/DashboardUserControllerTest.java
@@ -84,10 +84,10 @@ public final class DashboardUserControllerTest {
 
     private final DashboardUserDTO dashboardUserDTO = new 
DashboardUserDTO("2", "userName",
             "Admin@123", 0, Lists.newArrayList("1"), false);
-    
-    private final DashboardUserModifyPasswordDTO modifyPasswordDTO = new 
DashboardUserModifyPasswordDTO("2", 
-            "admin", "ShenYu=123", "ShenYu=123");
-    
+
+    private final DashboardUserModifyPasswordDTO modifyPasswordDTO = new 
DashboardUserModifyPasswordDTO("2",
+            "admin", "ShenYu=#.123", "ShenYu=#.123");
+
     @BeforeEach
     public void setUp() throws Exception {
         mockMvc = 
MockMvcBuilders.standaloneSetup(dashboardUserController).build();
@@ -172,7 +172,7 @@ public final class DashboardUserControllerTest {
                 .andExpect(jsonPath("$.message", 
is(ShenyuResultMessage.DELETE_SUCCESS)))
                 .andExpect(jsonPath("$.data", is(0)));
     }
-    
+
     @Test
     public void modifyPassword() throws Exception {
         final String url = "/dashboardUser/modify-password/2";
@@ -181,7 +181,7 @@ public final class DashboardUserControllerTest {
         principalMap.put("real", userInfo);
         ThreadContext.bind(new DefaultSecurityManager());
         ThreadContext.bind(new 
Subject.Builder().principals(principalMap).buildSubject());
-        
+
         given(dashboardUserService.modifyPassword(any())).willReturn(1);
         mockMvc.perform(put(url, modifyPasswordDTO)
                         
.content(GsonUtils.getInstance().toJson(modifyPasswordDTO))
@@ -190,7 +190,7 @@ public final class DashboardUserControllerTest {
                 .andDo(print())
                 .andExpect(jsonPath("$.message", 
is(ShenyuResultMessage.UPDATE_SUCCESS)))
                 .andExpect(jsonPath("$.data", is(1)));
-        
+
         ThreadContext.bind(new Subject.Builder().principals(new 
SimplePrincipalMap()).buildSubject());
         mockMvc.perform(put(url, modifyPasswordDTO)
                         
.content(GsonUtils.getInstance().toJson(modifyPasswordDTO))
@@ -198,6 +198,6 @@ public final class DashboardUserControllerTest {
                 .andExpect(status().isOk())
                 .andDo(print())
                 .andExpect(jsonPath("$.message", 
is(ShenyuResultMessage.DASHBOARD_USER_LOGIN_ERROR)));
-        
+
     }
 }

Reply via email to