diff options
| author | Joey Hess <id@joeyh.name> | 2014-12-05 17:44:14 -0400 |
|---|---|---|
| committer | Joey Hess <id@joeyh.name> | 2014-12-05 17:44:14 -0400 |
| commit | 9805f132ac6440bb8c2ca5957101db2cb59428c7 (patch) | |
| tree | f3f5a4aa009bc573b800cee89118afba00981101 /src/Propellor/Property/User.hs | |
| parent | dbc76b1e5225a28b84efa14659ff1c0c1d5fc463 (diff) | |
| parent | 5ae6a302df5c7bd71cd5dadb53e5bb5e710762b3 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/User.hs')
| -rw-r--r-- | src/Propellor/Property/User.hs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs index ccb69b24..5c8e768c 100644 --- a/src/Propellor/Property/User.hs +++ b/src/Propellor/Property/User.hs @@ -44,13 +44,15 @@ hasPassword user = property (user ++ "has password") $ do ensureProperty $ hasPassword' user (Context hostname) hasPassword' :: UserName -> Context -> Property -hasPassword' user context = withPrivData (Password user) context $ \getpassword -> - property (user ++ " has password") $ - getpassword $ \password -> makeChange $ - withHandle StdinHandle createProcessSuccess - (proc "chpasswd" []) $ \h -> do - hPutStrLn h $ user ++ ":" ++ password - hClose h +hasPassword' user context = go `requires` shadowConfig True + where + go = withPrivData (Password user) context $ \getpassword -> + property (user ++ " has password") $ + getpassword $ \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" |
