purr

password generation and secret sharing
Log | Files | Refs | README | LICENSE

HTTP.hs (945B)


      1 module Feature.Generation.HTTP ( routes ) where
      2 
      3 import           Core.Templates               (renderIndex)
      4 import           Core.Types
      5 
      6 import           Feature.Generation.Passwords 
      7 import           Feature.Generation.Templates (renderGen)
      8 
      9 import qualified Data.Text                    as T
     10 import qualified Data.Text.Lazy               as LT
     11 
     12 import           Control.Monad.Trans          (liftIO)
     13 import           Data.Maybe                   (listToMaybe)
     14 import           Prelude
     15 import           Web.Scotty
     16 
     17 {- "Generator" route that provides radio button options to share a randomly
     18    generated password. This usecase targets IT professionals that are setting
     19    up temporary account credentials for someone else. -}
     20 routes :: PurrApp ()
     21 routes = do
     22   get "/gen" $ do
     23     genXkcd      <- liftIO xkcd
     24     genOldschool <- liftIO oldschool
     25     genGibberish <- liftIO $ gibberish 18
     26     html $ renderGen genXkcd genOldschool genGibberish