Force User fields to be correct
This commit is contained in:
parent
b48efb1035
commit
efe7546a24
@ -209,8 +209,9 @@ addPWEntry :: FilePath {-^ Password file -}
|
||||
-> User
|
||||
-> Text {-^ Password -}
|
||||
-> IO ()
|
||||
addPWEntry pwFile pwUser' (Text.encodeUtf8 -> pw) = do
|
||||
addPWEntry pwFile User{..} (Text.encodeUtf8 -> pw) = do
|
||||
(Text.decodeUtf8 -> pwHash) <- makePassword pw 14
|
||||
let pwEntry = PWEntry{ pwUser = pwUser', .. }
|
||||
let pwEntry = PWEntry{ pwUser = User{ userPlugin = "PWFile", .. }, .. }
|
||||
newUser = userIdent
|
||||
c <- either (const []) id <$> Yaml.decodeFileEither pwFile
|
||||
Yaml.encodeFile pwFile $ pwEntry : [ c' | c' <- c, ((/=) `on` (userIdent . pwUser)) c' pwEntry ]
|
||||
Yaml.encodeFile pwFile $ pwEntry : [ c' | c'@(PWEntry{pwUser=User{..}}) <- c, userIdent /= newUser ]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user