confirm master password before creating new service
This commit is contained in:
parent
927ce27865
commit
a615538d96
|
@ -4,6 +4,7 @@
|
|||
|
||||
- refactoring
|
||||
- store the database where Windows can find it
|
||||
- confirm master password before creating new service
|
||||
|
||||
## 0.2
|
||||
|
||||
|
|
17
app/UI.hs
17
app/UI.hs
|
@ -20,6 +20,8 @@ License along with this program. If not, see
|
|||
|
||||
-}
|
||||
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
|
||||
module UI (getMasterPass, mainMenu) where
|
||||
|
||||
import Control.Lens (over, set, view, (^.))
|
||||
|
@ -37,6 +39,7 @@ import System.Console.HCL
|
|||
, reqPassword
|
||||
, reqResp
|
||||
, required
|
||||
, runRequest
|
||||
)
|
||||
|
||||
import Password
|
||||
|
@ -67,6 +70,20 @@ mainMenu =
|
|||
|
||||
addPassword :: S.StateT Status IO ()
|
||||
addPassword = do
|
||||
pass <- S.gets (^.masterPass)
|
||||
|
||||
lift (runRequest $ prompt "confirm master password: " reqPassword)
|
||||
>>= \case
|
||||
Nothing -> mainMenu
|
||||
Just chkPass
|
||||
| pass == chkPass -> addPassword'
|
||||
|
||||
| otherwise -> do
|
||||
lift $ putStrLn "Incorrect master password."
|
||||
mainMenu
|
||||
|
||||
addPassword' :: S.StateT Status IO ()
|
||||
addPassword' = do
|
||||
svc <- req $ prompt "service name: " reqResp
|
||||
ifServExists svc
|
||||
(do
|
||||
|
|
Loading…
Reference in New Issue
Block a user