request master password

This commit is contained in:
Jonathan Lamothe 2018-12-07 21:07:42 -05:00
parent 53b5c6d106
commit 1e71698388
3 changed files with 26 additions and 3 deletions

View File

@ -19,9 +19,30 @@ License along with this program. If not, see
<https://www.gnu.org/licenses/>. <https://www.gnu.org/licenses/>.
-} -}
module Main where module Main where
import System.Console.HCL
( Request (..)
, execReq
, prompt
, reqFail
, reqIO
, reqPassword
, required
)
main :: IO () main :: IO ()
main = undefined main = execReq getMasterPass
getMasterPass :: Request String
getMasterPass = do
p1 <- required $ prompt "master password: " reqPassword
p2 <- required $ prompt "confirm master password: " reqPassword
if p1 /= p2
then do
reqIO $ putStrLn "passwords do not match"
reqFail
else return p1
--jl --jl

View File

@ -26,7 +26,7 @@ library:
source-dirs: src source-dirs: src
executables: executables:
passman-exe: passman:
main: Main.hs main: Main.hs
source-dirs: app source-dirs: app
ghc-options: ghc-options:
@ -35,6 +35,7 @@ executables:
- -with-rtsopts=-N - -with-rtsopts=-N
dependencies: dependencies:
- passman - passman
- HCL >= 1.7.1 && < 2
tests: tests:
passman-test: passman-test:

View File

@ -37,7 +37,8 @@ packages:
# Dependency packages to be pulled from upstream that are not in the resolver # Dependency packages to be pulled from upstream that are not in the resolver
# using the same syntax as the packages field. # using the same syntax as the packages field.
# (e.g., acme-missiles-0.3) # (e.g., acme-missiles-0.3)
# extra-deps: [] extra-deps:
- HCL-1.7.1@sha256:7bc617fbc9ba4b1f9c10d9b3e195042c1f031629f86d08253eec87660492d646
# Override default flag values for local packages and extra-deps # Override default flag values for local packages and extra-deps
# flags: {} # flags: {}