removed applyPWPolicy

This commit is contained in:
Jonathan Lamothe
2018-12-17 14:30:32 -05:00
parent 14e367bd43
commit 2b9bedced5
3 changed files with 1 additions and 73 deletions

View File

@@ -33,7 +33,7 @@ module Password (
-- ** Default Instances
newPWPolicy,
-- * Functions
validatePWPolicy, applyPWPolicy
validatePWPolicy
) where
import Control.Lens (makeLenses, (^.))
@@ -83,22 +83,4 @@ validatePWPolicy x = and
needed = x^.pwUpper + x^.pwLower + x^.pwDigits + special
special = fromMaybe 0 $ x^.pwSpecial
-- | checks whether or not a password meets a given password policy
applyPWPolicy
:: String
-- ^ the password
-> PWPolicy
-- ^ the policy
-> Bool
-- ^ @"True"@ if the password meets the policy, @"False"@ otherwise
applyPWPolicy pw policy = and
[ length pw <= policy^.pwLength
, length (filter isUpper pw) >= policy^.pwUpper
, length (filter isLower pw) >= policy^.pwLower
, length (filter isDigit pw) >= policy^.pwDigits
, length (filter (not . isAlphaNum) pw) >=
fromMaybe (succ $ policy^.pwLength) (policy^.pwSpecial)
, validatePWPolicy policy
]
--jl