chore(codebase): full cleanup pass

This commit is contained in:
2025-06-21 01:58:48 -04:00
parent 8323477cd0
commit 81b5db34ef
92 changed files with 529 additions and 452 deletions

View File

@@ -21,38 +21,54 @@ public static class PasswordGenerator
bool requireSpecialCharacter = true)
{
// Create pools based on the requirements
var characterPool = new StringBuilder();
StringBuilder characterPool = new();
if (requireNumber)
{
characterPool.Append(LowerLetters);
}
if (requireCapital)
{
characterPool.Append(UpperLetters);
}
if (requireNumber)
{
characterPool.Append(Numbers);
}
if (requireSpecialCharacter)
{
characterPool.Append(SpecialCharacters);
}
// Ensure that the length is within the specified bounds
var password = new char[length];
char[] password = new char[length];
// Ensure at least one character from each required category is included
int index = 0;
if (requireLowercase)
{
password[index++] = LowerLetters[Random.Next(LowerLetters.Length)];
}
if (requireCapital)
{
password[index++] = UpperLetters[Random.Next(UpperLetters.Length)];
}
if (requireNumber)
{
password[index++] = Numbers[Random.Next(Numbers.Length)];
}
if (requireSpecialCharacter)
{
password[index++] = SpecialCharacters[Random.Next(SpecialCharacters.Length)];
}
// Fill the rest with the password
for (int i = index; i < length; i++)
{