Update serversession-frontend-yesod for yesod-1.6

This commit is contained in:
Ian Duncan 2018-05-23 09:34:16 +09:00
parent 7939f1decb
commit b75117c138
3 changed files with 18 additions and 17 deletions

View File

@ -37,7 +37,7 @@ instance HasHttpManager App where
mkYesodData "App" $(parseRoutesFile "config/routes")
-- | A convenient synonym for creating forms.
type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
type Form x = Html -> MForm (HandlerFor App) (FormResult x, Widget)
-- | Cookie name used for the sessions of this example app.
sessionCookieName :: Text
@ -104,7 +104,7 @@ instance Yesod App where
-- What messages should be logged. The following includes all messages when
-- in development, and warnings and errors in production.
shouldLog app _source level =
shouldLogIO app _source level = return $
appShouldLogAll (appSettings app)
|| level == LevelWarn
|| level == LevelError
@ -117,6 +117,7 @@ instance YesodPersist App where
runDB action = do
master <- getYesod
runSqlPool action $ appConnPool master
instance YesodPersistRunner App where
getDBRunner = defaultGetDBRunner appConnPool
@ -130,11 +131,11 @@ instance YesodAuth App where
-- Override the above two destinations when a Referer: header is present
redirectToReferer _ = True
getAuthId creds = runDB $ do
authenticate creds = liftHandler $ runDB $ do
x <- getBy $ UniqueUser $ credsIdent creds
case x of
Just (Entity uid _) -> return $ Just uid
Nothing -> Just <$> insert User
Just (Entity uid _) -> return $ Authenticated uid
Nothing -> Authenticated <$> insert User
{ userIdent = credsIdent creds
, userPassword = Nothing
}
@ -142,7 +143,7 @@ instance YesodAuth App where
-- You can add other plugins like BrowserID, email or OAuth here
authPlugins _ = [authDummy]
authHttpManager = getHttpManager
authHttpManager = getHttpManager <$> getYesod
instance YesodAuthPersist App

View File

@ -32,7 +32,7 @@ library
, transformers
, unordered-containers
, wai
, yesod-core == 1.4.*
, yesod-core >= 1.6
, serversession == 1.0.*
exposed-modules:

View File

@ -1,4 +1,4 @@
resolver: lts-10.3
resolver: lts-11.9
packages:
- serversession
- serversession-backend-acid-state
@ -24,14 +24,14 @@ flags:
serversession-frontend-yesod:
lib-Werror: true
extra-deps:
# for lts 9, 10
- acid-state-0.14.3
- snap-1.1.0.0
- snap-core-1.0.3.1
- snap-server-1.0.3.3
- heist-1.0.1.2
- map-syntax-0.2.0.2
- xmlhtml-0.2.5.2
# for lts 9, 10
# - snap-1.1.0.0
# - snap-core-1.0.3.1
# - snap-server-1.0.3.3
# - heist-1.0.1.2
# - map-syntax-0.2.0.2
# - xmlhtml-0.2.5.2
# for lts-8
- blaze-html-0.9.0.1
- blaze-markup-0.8.2.0
# - blaze-html-0.9.0.1
# - blaze-markup-0.8.2.0