1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
{-|
Module: Password
Copyright: (C) 2016-2017 Ryan Scott
License: BSD-style (see the file LICENSE)
Maintainer: Ryan Scott
Stability: Provisional
Portability: Portable
A simple program which prompts you for your username and password (without
leaking your password onto the screen as you type it).
-}
module Main (main) where
import System.IO (hFlush, stdout)
import System.IO.Echo (withoutInputEcho)
main :: IO ()
main = do
putLabel "Username: "
username <- getLine
putLabel "Password: "
password <- withoutInputEcho getLine
putStrLn ""
putStrLn "-----------------------------------"
putStrLn $ "Your username is: " ++ username
putStrLn $ "Your password is: " ++ password
where
putLabel label = putStr label >> hFlush stdout
|