implemented character type counting

This commit is contained in:
Jonathan Lamothe 2018-12-20 22:15:43 -05:00
parent bbf80b87ec
commit 67d6f7a546

View File

@ -167,13 +167,21 @@ pwGenerate pw d = if validatePWData d
else Nothing else Nothing
where seed = mkSeed pw d where seed = mkSeed pw d
-- | counts upper case characters in a password
pwCountUpper
:: String
-- ^ the password
-> Int
-- ^ the count
pwCountUpper = length . filter isUpper
-- | counts lower case characters in a password -- | counts lower case characters in a password
pwCountLower pwCountLower
:: String :: String
-- ^ the password -- ^ the password
-> Int -> Int
-- ^ the count -- ^ the count
pwCountLower = undefined pwCountLower = length . filter isLower
-- | counts digits in a password -- | counts digits in a password
pwCountDigits pwCountDigits
@ -181,7 +189,7 @@ pwCountDigits
-- ^ the password -- ^ the password
-> Int -> Int
-- ^ the count -- ^ the count
pwCountDigits = undefined pwCountDigits = length . filter isDigit
-- | counts special characters in a password -- | counts special characters in a password
pwCountSpecial pwCountSpecial
@ -189,15 +197,10 @@ pwCountSpecial
-- ^ the password -- ^ the password
-> Int -> Int
-- ^ the count -- ^ the count
pwCountSpecial = undefined pwCountSpecial = length . filter isSpecial
-- | counts upper case characters in a password isSpecial :: Char -> Bool
pwCountUpper isSpecial x = not $ isUpper x || isLower x || isDigit x
:: String
-- ^ the password
-> Int
-- ^ the count
pwCountUpper = undefined
mkPass :: String -> PWPolicy -> String mkPass :: String -> PWPolicy -> String
mkPass (x:xs) p = let p' = nextPolicy x p in mkPass (x:xs) p = let p' = nextPolicy x p in