summaryrefslogtreecommitdiff
path: root/Property/User.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Property/User.hs')
-rw-r--r--Property/User.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Property/User.hs b/Property/User.hs
index 58bfa37a..dcbf56c9 100644
--- a/Property/User.hs
+++ b/Property/User.hs
@@ -4,8 +4,6 @@ import System.Posix
import Common
-type UserName = String
-
data Eep = YesReallyDeleteHome
sshAccountFor :: UserName -> Property
@@ -24,6 +22,14 @@ nuked user _ = check (isJust <$> homedir user) $ cmdProperty "userdel"
]
`describe` ("nuked user " ++ user)
+setPassword :: UserName -> Property
+setPassword user = Property (user ++ " password set") $
+ withPrivData (Password user) $ \password -> makeChange $
+ withHandle StdinHandle createProcessSuccess
+ (proc "chpasswd" []) $ \h -> do
+ hPutStrLn h $ user ++ ":" ++ password
+ hClose h
+
lockedPassword :: UserName -> Property
lockedPassword user = check (not <$> isLockedPassword user) $ cmdProperty "passwd"
[ Param "--lock"