upgrade scaffold to 0.9
This commit is contained in:
parent
9206a0554d
commit
15142f344f
@ -9,8 +9,8 @@ module Controller
|
||||
|
||||
import ~sitearg~
|
||||
import Settings
|
||||
import Yesod.Helpers.Static
|
||||
import Yesod.Helpers.Auth
|
||||
import Yesod.Static
|
||||
import Yesod.Auth
|
||||
import Database.Persist.GenericSql
|
||||
import Data.ByteString (ByteString)
|
||||
import Data.Dynamic (Dynamic, toDyn)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving, TemplateHaskell #-}
|
||||
{-# LANGUAGE QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving, TemplateHaskell, GADTs #-}
|
||||
module Model where
|
||||
|
||||
import Yesod
|
||||
|
||||
@ -47,9 +47,10 @@ executable ~project~
|
||||
hs-source-dirs: ., config
|
||||
|
||||
build-depends: base >= 4 && < 5
|
||||
, yesod >= 0.8 && < 0.9
|
||||
, yesod-auth >= 0.4 && < 0.5
|
||||
, yesod-static >= 0.1 && < 0.2
|
||||
, yesod >= 0.9 && < 0.10
|
||||
, yesod-auth
|
||||
, yesod-static
|
||||
, blaze-html
|
||||
, yesod-form
|
||||
, mime-mail
|
||||
, clientsession
|
||||
@ -59,7 +60,7 @@ executable ~project~
|
||||
, text
|
||||
, persistent
|
||||
, persistent-template
|
||||
, persistent-~backendLower~ >= 0.5 && < 0.6
|
||||
, persistent-~backendLower~ >= 0.6 && < 0.7
|
||||
, template-haskell
|
||||
, hamlet
|
||||
, hjsmin
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-}
|
||||
module StaticFiles where
|
||||
|
||||
import Yesod.Helpers.Static
|
||||
import Yesod.Static
|
||||
|
||||
-- | This generates easy references to files in the static directory at compile time.
|
||||
-- The upside to this is that you have compile-time verification that referenced files
|
||||
|
||||
@ -9,7 +9,7 @@ module Controller
|
||||
|
||||
import ~sitearg~
|
||||
import Settings
|
||||
import Yesod.Helpers.Static
|
||||
import Yesod.Static
|
||||
import Data.ByteString (ByteString)
|
||||
import Network.Wai (Application)
|
||||
import Data.Dynamic (Dynamic, toDyn)
|
||||
|
||||
@ -46,7 +46,7 @@ executable ~project~
|
||||
hs-source-dirs: ., config
|
||||
|
||||
build-depends: base >= 4 && < 5
|
||||
, yesod-core >= 0.8 && < 0.9
|
||||
, yesod-core >= 0.9 && < 0.10
|
||||
, yesod-static
|
||||
, clientsession
|
||||
, wai-extra
|
||||
|
||||
@ -14,7 +14,7 @@ module ~sitearg~
|
||||
) where
|
||||
|
||||
import Yesod.Core
|
||||
import Yesod.Helpers.Static
|
||||
import Yesod.Static
|
||||
import qualified Settings
|
||||
import System.Directory
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
|
||||
@ -17,10 +17,10 @@ module ~sitearg~
|
||||
|
||||
import Yesod
|
||||
import Yesod.Form (defaultFormMessage)
|
||||
import Yesod.Helpers.Static
|
||||
import Yesod.Helpers.Auth
|
||||
import Yesod.Helpers.Auth.OpenId
|
||||
import Yesod.Helpers.Auth.Email
|
||||
import Yesod.Static
|
||||
import Yesod.Auth
|
||||
import Yesod.Auth.OpenId
|
||||
import Yesod.Auth.Email
|
||||
import qualified Settings
|
||||
import System.Directory
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
@ -36,6 +36,7 @@ import qualified Data.Text.Lazy.Encoding
|
||||
import Text.Jasmine (minifym)
|
||||
import qualified Data.Text as T
|
||||
import Web.ClientSession (getKey)
|
||||
import Text.Blaze.Renderer.String (renderHtml)
|
||||
|
||||
-- | The site argument for your application. This can be a good place to
|
||||
-- keep settings and values requiring initialization before your application
|
||||
@ -185,7 +186,7 @@ instance YesodAuthEmail ~sitearg~ where
|
||||
, partHeaders = []
|
||||
}
|
||||
getVerifyKey = runDB . fmap (join . fmap emailVerkey) . get
|
||||
setVerifyKey eid key = runDB $ update eid [EmailVerkey $ Just key]
|
||||
setVerifyKey eid key = runDB $ update eid [EmailVerkey =. Just key]
|
||||
verifyAccount eid = runDB $ do
|
||||
me <- get eid
|
||||
case me of
|
||||
@ -196,10 +197,10 @@ instance YesodAuthEmail ~sitearg~ where
|
||||
Just uid -> return $ Just uid
|
||||
Nothing -> do
|
||||
uid <- insert $ User email Nothing
|
||||
update eid [EmailUser $ Just uid, EmailVerkey Nothing]
|
||||
update eid [EmailUser =. Just uid, EmailVerkey =. Nothing]
|
||||
return $ Just uid
|
||||
getPassword = runDB . fmap (join . fmap userPassword) . get
|
||||
setPassword uid pass = runDB $ update uid [UserPassword $ Just pass]
|
||||
setPassword uid pass = runDB $ update uid [UserPassword =. Just pass]
|
||||
getEmailCreds email = runDB $ do
|
||||
me <- getBy $ UniqueEmail email
|
||||
case me of
|
||||
|
||||
Loading…
Reference in New Issue
Block a user