From f76d5a64428b18b965bc0d95274505771beff605 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 9 Jun 2010 10:11:13 +0300 Subject: [PATCH] Integrate Contrib --- Yesod.hs | 4 +++- Yesod/Contrib/Crud.hs | 9 ++++++++- Yesod/Contrib/Persist.hs | 9 +++++++-- Yesod/Helpers/Auth.hs | 7 ++----- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Yesod.hs b/Yesod.hs index 82afafb1..56f5b623 100644 --- a/Yesod.hs +++ b/Yesod.hs @@ -10,6 +10,7 @@ module Yesod , module Yesod.Form , module Yesod.Hamlet , module Yesod.Json + , module Yesod.Contrib , Application , liftIO , Routes @@ -26,10 +27,11 @@ import Yesod.Dispatch #endif import Yesod.Request -import Yesod.Form +import Yesod.Form hiding (Form) import Yesod.Yesod import Yesod.Handler hiding (runHandler) import Network.Wai (Application) import Yesod.Hamlet import "transformers" Control.Monad.IO.Class (liftIO) import Web.Routes.Quasi (Routes) +import Yesod.Contrib diff --git a/Yesod/Contrib/Crud.hs b/Yesod/Contrib/Crud.hs index 0e3fd23b..ab573c8d 100644 --- a/Yesod/Contrib/Crud.hs +++ b/Yesod/Contrib/Crud.hs @@ -3,7 +3,14 @@ {-# LANGUAGE Rank2Types #-} module Yesod.Contrib.Crud where -import Yesod hiding (Form) +import Yesod.Yesod +import Yesod.Dispatch +import Yesod.Content +import Yesod.Handler +import Yesod.Request +import Text.Hamlet +import Control.Monad.IO.Class (liftIO) +import Web.Routes.Quasi import Database.Persist import Control.Applicative.Error import Yesod.Contrib.Formable hiding (runForm) diff --git a/Yesod/Contrib/Persist.hs b/Yesod/Contrib/Persist.hs index a009ff5a..51b6f74b 100644 --- a/Yesod/Contrib/Persist.hs +++ b/Yesod/Contrib/Persist.hs @@ -1,7 +1,12 @@ {-# LANGUAGE TypeFamilies #-} -module Yesod.Contrib.Persist where +module Yesod.Contrib.Persist + ( YesodPersist (..) + , Persist (..) + ) where -import Yesod +import Yesod.Handler +import Yesod.Yesod +import Database.Persist class YesodPersist y where type YesodDB y :: (* -> *) -> * -> * diff --git a/Yesod/Helpers/Auth.hs b/Yesod/Helpers/Auth.hs index c52da2d8..f920bb3c 100644 --- a/Yesod/Helpers/Auth.hs +++ b/Yesod/Helpers/Auth.hs @@ -301,7 +301,7 @@ getEmailRegisterR = do postEmailRegisterR :: YesodAuth master => GHandler Auth master RepHtml postEmailRegisterR = do ae <- getAuthEmailSettings - email <- runFormPost $ checkEmail $ required $ input "email" + email <- runFormPost $ notEmpty $ required $ input "email" -- FIXME checkEmail y <- getYesod mecreds <- liftIO $ getEmailCreds ae email (lid, verKey) <- @@ -319,9 +319,6 @@ postEmailRegisterR = do %p A confirmation e-mail has been sent to $string.email$. |] -checkEmail :: Form ParamValue -> Form ParamValue -checkEmail = notEmpty -- FIXME consider including e-mail validation - getEmailVerifyR :: YesodAuth master => Integer -> String -> GHandler Auth master RepHtml getEmailVerifyR lid key = do @@ -368,7 +365,7 @@ postEmailLoginR :: YesodAuth master => GHandler Auth master () postEmailLoginR = do ae <- getAuthEmailSettings (email, pass) <- runFormPost $ (,) - <$> checkEmail (required $ input "email") + <$> notEmpty (required $ input "email") -- FIXME valid e-mail? <*> required (input "password") y <- getYesod mecreds <- liftIO $ getEmailCreds ae email