Various scaffolding tweaks
This commit is contained in:
parent
adbc9e1868
commit
254795cb40
@ -13,7 +13,7 @@ import qualified Data.Text.Lazy.Encoding as LT
|
|||||||
import Control.Monad (when, unless)
|
import Control.Monad (when, unless)
|
||||||
|
|
||||||
qq :: String
|
qq :: String
|
||||||
#if GHC7
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
qq = ""
|
qq = ""
|
||||||
#else
|
#else
|
||||||
qq = "$"
|
qq = "$"
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
module Model where
|
module Model where
|
||||||
|
|
||||||
import Yesod
|
import Yesod
|
||||||
import Database.Persist.TH (share, mkMigrate)
|
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
|
|
||||||
-- You can define all of your database entities in the entities file.
|
-- You can define all of your database entities in the entities file.
|
||||||
|
|||||||
@ -24,7 +24,6 @@ import Control.Monad (unless)
|
|||||||
import Control.Monad.Trans.Class (lift)
|
import Control.Monad.Trans.Class (lift)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Blaze.ByteString.Builder.Char.Utf8 (fromText)
|
|
||||||
|
|
||||||
-- | The site argument for your application. This can be a good place to
|
-- | The site argument for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
@ -78,7 +77,7 @@ instance Yesod ~sitearg~ where
|
|||||||
-- This is done to provide an optimization for serving static files from
|
-- This is done to provide an optimization for serving static files from
|
||||||
-- a separate domain. Please see the staticroot setting in Settings.hs
|
-- a separate domain. Please see the staticroot setting in Settings.hs
|
||||||
urlRenderOverride a (StaticR s) =
|
urlRenderOverride a (StaticR s) =
|
||||||
Just $ uncurry (joinPath a $ fromText Settings.staticroot) $ renderRoute s
|
Just $ uncurry (joinPath a Settings.staticroot) $ renderRoute s
|
||||||
urlRenderOverride _ _ = Nothing
|
urlRenderOverride _ _ = Nothing
|
||||||
|
|
||||||
-- This function creates static content files in the static folder
|
-- This function creates static content files in the static folder
|
||||||
|
|||||||
@ -34,7 +34,6 @@ import qualified Data.Text.Lazy
|
|||||||
import qualified Data.Text.Lazy.Encoding
|
import qualified Data.Text.Lazy.Encoding
|
||||||
import Text.Jasmine (minifym)
|
import Text.Jasmine (minifym)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Blaze.ByteString.Builder.Char.Utf8 (fromText)
|
|
||||||
|
|
||||||
-- | The site argument for your application. This can be a good place to
|
-- | The site argument for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
@ -89,7 +88,7 @@ instance Yesod ~sitearg~ where
|
|||||||
-- This is done to provide an optimization for serving static files from
|
-- This is done to provide an optimization for serving static files from
|
||||||
-- a separate domain. Please see the staticroot setting in Settings.hs
|
-- a separate domain. Please see the staticroot setting in Settings.hs
|
||||||
urlRenderOverride a (StaticR s) =
|
urlRenderOverride a (StaticR s) =
|
||||||
Just $ uncurry (joinPath a $ fromText Settings.staticroot) $ renderRoute s
|
Just $ uncurry (joinPath a Settings.staticroot) $ renderRoute s
|
||||||
urlRenderOverride _ _ = Nothing
|
urlRenderOverride _ _ = Nothing
|
||||||
|
|
||||||
-- The page to be redirected to when authentication is required.
|
-- The page to be redirected to when authentication is required.
|
||||||
@ -135,9 +134,6 @@ instance YesodAuth ~sitearg~ where
|
|||||||
Nothing -> do
|
Nothing -> do
|
||||||
fmap Just $ insert $ User (credsIdent creds) Nothing
|
fmap Just $ insert $ User (credsIdent creds) Nothing
|
||||||
|
|
||||||
showAuthId _ = showKey (undefined :: YesodDB ~sitearg~ IO a) . fromPersistKey
|
|
||||||
readAuthId _ = fmap toPersistKey . readKey (undefined :: YesodDB ~sitearg~ IO a)
|
|
||||||
|
|
||||||
authPlugins = [ authOpenId
|
authPlugins = [ authOpenId
|
||||||
, authEmail
|
, authEmail
|
||||||
]
|
]
|
||||||
@ -145,9 +141,6 @@ instance YesodAuth ~sitearg~ where
|
|||||||
instance YesodAuthEmail ~sitearg~ where
|
instance YesodAuthEmail ~sitearg~ where
|
||||||
type AuthEmailId ~sitearg~ = EmailId
|
type AuthEmailId ~sitearg~ = EmailId
|
||||||
|
|
||||||
showAuthEmailId _ = showKey (undefined :: YesodDB ~sitearg~ IO a) . fromPersistKey
|
|
||||||
readAuthEmailId _ = fmap toPersistKey . readKey (undefined :: YesodDB ~sitearg~ IO a)
|
|
||||||
|
|
||||||
addUnverified email verkey =
|
addUnverified email verkey =
|
||||||
runDB $ insert $ Email email Nothing $ Just verkey
|
runDB $ insert $ Email email Nothing $ Just verkey
|
||||||
sendVerifyEmail email _ verurl = liftIO $ renderSendMail Mail
|
sendVerifyEmail email _ verurl = liftIO $ renderSendMail Mail
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user