Merge pull request #16 from betterteamapp/master
Update serversession-frontend-yesod for yesod-1.6
This commit is contained in:
commit
4647b755bf
@ -37,7 +37,7 @@ instance HasHttpManager App where
|
|||||||
mkYesodData "App" $(parseRoutesFile "config/routes")
|
mkYesodData "App" $(parseRoutesFile "config/routes")
|
||||||
|
|
||||||
-- | A convenient synonym for creating forms.
|
-- | 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.
|
-- | Cookie name used for the sessions of this example app.
|
||||||
sessionCookieName :: Text
|
sessionCookieName :: Text
|
||||||
@ -104,7 +104,7 @@ instance Yesod App where
|
|||||||
|
|
||||||
-- What messages should be logged. The following includes all messages when
|
-- What messages should be logged. The following includes all messages when
|
||||||
-- in development, and warnings and errors in production.
|
-- in development, and warnings and errors in production.
|
||||||
shouldLog app _source level =
|
shouldLogIO app _source level = return $
|
||||||
appShouldLogAll (appSettings app)
|
appShouldLogAll (appSettings app)
|
||||||
|| level == LevelWarn
|
|| level == LevelWarn
|
||||||
|| level == LevelError
|
|| level == LevelError
|
||||||
@ -117,6 +117,7 @@ instance YesodPersist App where
|
|||||||
runDB action = do
|
runDB action = do
|
||||||
master <- getYesod
|
master <- getYesod
|
||||||
runSqlPool action $ appConnPool master
|
runSqlPool action $ appConnPool master
|
||||||
|
|
||||||
instance YesodPersistRunner App where
|
instance YesodPersistRunner App where
|
||||||
getDBRunner = defaultGetDBRunner appConnPool
|
getDBRunner = defaultGetDBRunner appConnPool
|
||||||
|
|
||||||
@ -130,11 +131,11 @@ instance YesodAuth App where
|
|||||||
-- Override the above two destinations when a Referer: header is present
|
-- Override the above two destinations when a Referer: header is present
|
||||||
redirectToReferer _ = True
|
redirectToReferer _ = True
|
||||||
|
|
||||||
getAuthId creds = runDB $ do
|
authenticate creds = liftHandler $ runDB $ do
|
||||||
x <- getBy $ UniqueUser $ credsIdent creds
|
x <- getBy $ UniqueUser $ credsIdent creds
|
||||||
case x of
|
case x of
|
||||||
Just (Entity uid _) -> return $ Just uid
|
Just (Entity uid _) -> return $ Authenticated uid
|
||||||
Nothing -> Just <$> insert User
|
Nothing -> Authenticated <$> insert User
|
||||||
{ userIdent = credsIdent creds
|
{ userIdent = credsIdent creds
|
||||||
, userPassword = Nothing
|
, userPassword = Nothing
|
||||||
}
|
}
|
||||||
@ -142,7 +143,7 @@ instance YesodAuth App where
|
|||||||
-- You can add other plugins like BrowserID, email or OAuth here
|
-- You can add other plugins like BrowserID, email or OAuth here
|
||||||
authPlugins _ = [authDummy]
|
authPlugins _ = [authDummy]
|
||||||
|
|
||||||
authHttpManager = getHttpManager
|
authHttpManager = getHttpManager <$> getYesod
|
||||||
|
|
||||||
instance YesodAuthPersist App
|
instance YesodAuthPersist App
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ library
|
|||||||
, transformers
|
, transformers
|
||||||
, unordered-containers
|
, unordered-containers
|
||||||
, wai
|
, wai
|
||||||
, yesod-core == 1.4.*
|
, yesod-core >= 1.6
|
||||||
|
|
||||||
, serversession == 1.0.*
|
, serversession == 1.0.*
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
|
|||||||
20
stack.yaml
20
stack.yaml
@ -1,4 +1,4 @@
|
|||||||
resolver: lts-10.3
|
resolver: lts-11.9
|
||||||
packages:
|
packages:
|
||||||
- serversession
|
- serversession
|
||||||
- serversession-backend-acid-state
|
- serversession-backend-acid-state
|
||||||
@ -24,14 +24,14 @@ flags:
|
|||||||
serversession-frontend-yesod:
|
serversession-frontend-yesod:
|
||||||
lib-Werror: true
|
lib-Werror: true
|
||||||
extra-deps:
|
extra-deps:
|
||||||
# for lts 9, 10
|
|
||||||
- acid-state-0.14.3
|
- acid-state-0.14.3
|
||||||
- snap-1.1.0.0
|
# for lts 9, 10
|
||||||
- snap-core-1.0.3.1
|
# - snap-1.1.0.0
|
||||||
- snap-server-1.0.3.3
|
# - snap-core-1.0.3.1
|
||||||
- heist-1.0.1.2
|
# - snap-server-1.0.3.3
|
||||||
- map-syntax-0.2.0.2
|
# - heist-1.0.1.2
|
||||||
- xmlhtml-0.2.5.2
|
# - map-syntax-0.2.0.2
|
||||||
|
# - xmlhtml-0.2.5.2
|
||||||
# for lts-8
|
# for lts-8
|
||||||
- blaze-html-0.9.0.1
|
# - blaze-html-0.9.0.1
|
||||||
- blaze-markup-0.8.2.0
|
# - blaze-markup-0.8.2.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user