handle empty input string in mkPass

This commit is contained in:
Jonathan Lamothe 2019-01-01 22:50:16 -05:00
parent cdff8c8917
commit 012486c045

View File

@ -323,12 +323,13 @@ isSpecial :: Char -> Bool
isSpecial = not . isAlphaNum
mkPass :: String -> PWPolicy -> String
mkPass (x:xs) p = let p' = nextPolicy x p in
if p^.pwLength <= 0
mkPass [] _ = "" -- this should never happen
mkPass (x:xs) p = if p^.pwLength <= 0
then ""
else if validatePWPolicy p'
then x : mkPass xs p'
else mkPass xs p
else let p' = nextPolicy x p in
if validatePWPolicy p'
then x : mkPass xs p'
else mkPass xs p
mkPool :: B.ByteString -> String
mkPool = toB64 . raw where