implemented password changing

This commit is contained in:
Jonathan Lamothe
2018-12-26 15:43:13 -05:00
parent 0f6cbc0b24
commit 318079dca8
2 changed files with 19 additions and 3 deletions

View File

@@ -116,9 +116,22 @@ servMenu x = menu x
editPassMenu :: String -> S.StateT Status IO ()
editPassMenu x = menu (x ++ " : Edit Password")
[ ( "cancel", servMenu x )
[ ( "generate new password", changeSalt x )
, ( "cancel", servMenu x )
]
changeSalt :: String -> S.StateT Status IO ()
changeSalt x = do
db <- S.gets $ view database
case pwGetService x db of
Nothing -> mainMenu
Just serv -> do
salt <- run newPWSalt
let serv' = set pwSalt salt serv
S.modify $ over database (pwSetService x serv')
showPass x
servMenu x
changeMasterPass :: S.StateT Status IO ()
changeMasterPass = do
oldP <- S.gets $ view masterPass
@@ -154,7 +167,7 @@ showPass x = do
buildData :: S.StateT Status IO PWData
buildData = do
d <- S.StateT $ return . newPWData
d <- run newPWData
req $ reqIf (confirm "would you like to change the default policy?")
(do
let p = d^.pwPolicy