--------------------------------------------------------------------------------

postAPILoginR :: APIHandler Value
postAPILoginR = lift $ do
    mu    <-                       lookupTypedHeader HUserName
    mpw   <- fmap hashPassword <$> lookupTypedHeader HPassword
    b <- validateUser' mu mpw
    when b $ setCreds False $ Creds "PostAPILoginR" ((fromJust mu)^.unUserName) []
    return $ toJSON b
  where
    validateUser' mu mpw = fromMaybe (pure False) $ validateUser <$> mu <*> mpw


--------------------------------------------------------------------------------
postAPILoginR :: APIHandler Value
postAPILoginR = lift $ do
    mu    <-                       lookupTypedHeader HUserName
    mpw   <- fmap hashPassword <$> lookupTypedHeader HPassword
    b <- validateUser' mu mpw
    when b $ setCreds False $ Creds "PostAPILoginR" ((fromJust mu)^.unUserName) []
    return $ toJSON b
  where
    validateUser' mu mpw = fromMaybe (pure False) $ validateUser <$> mu <*> mpw


--------------------------------------------------------------------------------
postAPILoginR = lift $ do
    mu    <-                       lookupTypedHeader HUserName
    mpw   <- fmap hashPassword <$> lookupTypedHeader HPassword
    b <- validateUser' mu mpw
    when b $ setCreds False $ Creds "PostAPILoginR" ((fromJust mu)^.unUserName) []
    return $ toJSON b
  where
    validateUser' mu mpw = fromMaybe (pure False) $ validateUser <$> mu <*> mpw


--------------------------------------------------------------------------------