implemented service removal

This commit is contained in:
Jonathan Lamothe 2018-12-31 14:29:44 -05:00
parent b52380a10b
commit 4fb0920e88

View File

@ -142,9 +142,10 @@ selectServ xs = menu "Select Service" $
servMenu :: String -> S.StateT Status IO () servMenu :: String -> S.StateT Status IO ()
servMenu x = menu x servMenu x = menu x
[ ( "show password", showPass x >> servMenu x ) [ ( "show password", showPass x >> servMenu x )
, ( "edit password", editPassMenu x ) , ( "edit password", editPassMenu x )
, ( "back", mainMenu ) , ( "remove service", removeServ x )
, ( "back", mainMenu )
] ]
editPassMenu :: String -> S.StateT Status IO () editPassMenu :: String -> S.StateT Status IO ()
@ -154,6 +155,16 @@ editPassMenu x = menu (x ++ " : Edit Password")
, ( "back", servMenu x ) , ( "back", servMenu x )
] ]
removeServ :: String -> S.StateT Status IO ()
removeServ x = do
go <- req $ confirm $
"Are you sure you want to delete the password for " ++ x ++ "?"
if go
then do
S.modify $ over database $ pwRemoveService x
mainMenu
else servMenu x
changeSalt :: String -> S.StateT Status IO () changeSalt :: String -> S.StateT Status IO ()
changeSalt x = withService x mainMenu $ \d -> do changeSalt x = withService x mainMenu $ \d -> do
salt <- run newPWSalt salt <- run newPWSalt