session locking implemented
This commit is contained in:
parent
b27faf2948
commit
a365632363
12
app/Main.hs
12
app/Main.hs
|
@ -61,6 +61,7 @@ mainMenu :: S.StateT Status IO ()
|
|||
mainMenu = do
|
||||
menu "Main Menu"
|
||||
[ ( "change master password", changeMasterPass )
|
||||
, ( "lock session", lockSession )
|
||||
, ( "quit", quit )
|
||||
]
|
||||
|
||||
|
@ -71,6 +72,17 @@ changeMasterPass = do
|
|||
S.modify $ set masterPass newP
|
||||
mainMenu
|
||||
|
||||
lockSession :: S.StateT Status IO ()
|
||||
lockSession = do
|
||||
lift $ putStrLn "\nsession locked"
|
||||
pass <- S.gets $ view masterPass
|
||||
mx <- lift $ R.runRequest $ R.prompt "password: " $ R.reqPassword
|
||||
case mx of
|
||||
Nothing -> lockSession
|
||||
Just x -> if x == pass
|
||||
then mainMenu
|
||||
else lockSession
|
||||
|
||||
quit :: S.StateT Status IO ()
|
||||
quit = return ()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user