You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "JoaoJandre (via GitHub)" <gi...@apache.org> on 2023/01/30 19:03:11 UTC

[GitHub] [cloudstack] JoaoJandre commented on a diff in pull request #7134: password-complexity(adding special characters)

JoaoJandre commented on code in PR #7134:
URL: https://github.com/apache/cloudstack/pull/7134#discussion_r1091030700


##########
utils/src/main/java/com/cloud/utils/PasswordGenerator.java:
##########
@@ -41,6 +41,8 @@ public class PasswordGenerator {
     static private char[] alphaNumeric = new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
         'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '2', '3', '4', '5', '6', '7', '8', '9'};
 
+    static private char[] symbols = new char[] {'!', '#', '@', '(', '%', '^', '&', '*', '$', ')', '-', '_', '+', '=', '{', '}', '[', ']', '|', '\\', ':', ';', '"', '\'', '<', '>', '.', '?'};

Review Comment:
   You could make this variable protected, and use it in your `containsSpecialChar` test in the ´PasswordGeneratorTest´ class, this way you don't need to create a new string with all these symbols.
   Furthermore if any new special symbol is added here, the test will cover it automatically as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org