Temporarily remove sessionIpAddress (#243)
This commit is contained in:
parent
4962529006
commit
2f38ddaff3
@ -137,6 +137,7 @@ setPassword pwd u = do salt <- randomSalt
|
|||||||
-- the database values.
|
-- the database values.
|
||||||
validateUser :: ( YesodPersist yesod
|
validateUser :: ( YesodPersist yesod
|
||||||
, b ~ YesodPersistBackend yesod
|
, b ~ YesodPersistBackend yesod
|
||||||
|
, b ~ PersistEntityBackend user
|
||||||
, PersistStore b (GHandler sub yesod)
|
, PersistStore b (GHandler sub yesod)
|
||||||
, PersistUnique b (GHandler sub yesod)
|
, PersistUnique b (GHandler sub yesod)
|
||||||
, PersistEntity user
|
, PersistEntity user
|
||||||
@ -163,6 +164,7 @@ login = PluginR "hashdb" ["login"]
|
|||||||
-- username (whatever it might be) to unique user ID.
|
-- username (whatever it might be) to unique user ID.
|
||||||
postLoginR :: ( YesodAuth y, YesodPersist y
|
postLoginR :: ( YesodAuth y, YesodPersist y
|
||||||
, b ~ YesodPersistBackend y
|
, b ~ YesodPersistBackend y
|
||||||
|
, b ~ PersistEntityBackend user
|
||||||
, HashDBUser user, PersistEntity user
|
, HashDBUser user, PersistEntity user
|
||||||
, PersistStore b (GHandler Auth y)
|
, PersistStore b (GHandler Auth y)
|
||||||
, PersistUnique b (GHandler Auth y))
|
, PersistUnique b (GHandler Auth y))
|
||||||
@ -188,6 +190,7 @@ getAuthIdHashDB :: ( YesodAuth master, YesodPersist master
|
|||||||
, HashDBUser user, PersistEntity user
|
, HashDBUser user, PersistEntity user
|
||||||
, Key b user ~ AuthId master
|
, Key b user ~ AuthId master
|
||||||
, b ~ YesodPersistBackend master
|
, b ~ YesodPersistBackend master
|
||||||
|
, b ~ PersistEntityBackend user
|
||||||
, PersistUnique b (GHandler sub master)
|
, PersistUnique b (GHandler sub master)
|
||||||
, PersistStore b (GHandler sub master))
|
, PersistStore b (GHandler sub master))
|
||||||
=> (AuthRoute -> Route master) -- ^ your site's Auth Route
|
=> (AuthRoute -> Route master) -- ^ your site's Auth Route
|
||||||
@ -216,6 +219,7 @@ authHashDB :: ( YesodAuth m, YesodPersist m
|
|||||||
, HashDBUser user
|
, HashDBUser user
|
||||||
, PersistEntity user
|
, PersistEntity user
|
||||||
, b ~ YesodPersistBackend m
|
, b ~ YesodPersistBackend m
|
||||||
|
, b ~ PersistEntityBackend user
|
||||||
, PersistStore b (GHandler Auth m)
|
, PersistStore b (GHandler Auth m)
|
||||||
, PersistUnique b (GHandler Auth m))
|
, PersistUnique b (GHandler Auth m))
|
||||||
=> (Text -> Maybe (Unique user b)) -> AuthPlugin m
|
=> (Text -> Maybe (Unique user b)) -> AuthPlugin m
|
||||||
|
|||||||
@ -39,8 +39,8 @@ library
|
|||||||
, unordered-containers
|
, unordered-containers
|
||||||
, yesod-form >= 0.4 && < 0.5
|
, yesod-form >= 0.4 && < 0.5
|
||||||
, transformers >= 0.2.2 && < 0.3
|
, transformers >= 0.2.2 && < 0.3
|
||||||
, persistent >= 0.7 && < 0.8
|
, persistent >= 0.8 && < 0.9
|
||||||
, persistent-template >= 0.7 && < 0.8
|
, persistent-template >= 0.8 && < 0.9
|
||||||
, SHA >= 1.4.1.3 && < 1.6
|
, SHA >= 1.4.1.3 && < 1.6
|
||||||
, http-conduit >= 1.2 && < 1.3
|
, http-conduit >= 1.2 && < 1.3
|
||||||
, aeson >= 0.5
|
, aeson >= 0.5
|
||||||
|
|||||||
@ -253,6 +253,7 @@ class RenderRoute a => Yesod a where
|
|||||||
-> GHandler sub a (Maybe (Either Text (Route a, [(Text, Text)])))
|
-> GHandler sub a (Maybe (Either Text (Route a, [(Text, Text)])))
|
||||||
addStaticContent _ _ _ = return Nothing
|
addStaticContent _ _ _ = return Nothing
|
||||||
|
|
||||||
|
{- Temporarily disabled until we have a better interface.
|
||||||
-- | Whether or not to tie a session to a specific IP address. Defaults to
|
-- | Whether or not to tie a session to a specific IP address. Defaults to
|
||||||
-- 'False'.
|
-- 'False'.
|
||||||
--
|
--
|
||||||
@ -261,6 +262,7 @@ class RenderRoute a => Yesod a where
|
|||||||
-- function correctly if the user is behind a proxy.
|
-- function correctly if the user is behind a proxy.
|
||||||
sessionIpAddress :: a -> Bool
|
sessionIpAddress :: a -> Bool
|
||||||
sessionIpAddress _ = False
|
sessionIpAddress _ = False
|
||||||
|
-}
|
||||||
|
|
||||||
-- | The path value to set for cookies. By default, uses \"\/\", meaning
|
-- | The path value to set for cookies. By default, uses \"\/\", meaning
|
||||||
-- cookies will be sent to every page on the current domain.
|
-- cookies will be sent to every page on the current domain.
|
||||||
@ -364,8 +366,8 @@ defaultYesodRunner handler master sub murl toMasterRoute mkey req = do
|
|||||||
now <- {-# SCC "getCurrentTime" #-} liftIO getCurrentTime
|
now <- {-# SCC "getCurrentTime" #-} liftIO getCurrentTime
|
||||||
let getExpires m = {-# SCC "getExpires" #-} fromIntegral (m * 60) `addUTCTime` now
|
let getExpires m = {-# SCC "getExpires" #-} fromIntegral (m * 60) `addUTCTime` now
|
||||||
let exp' = {-# SCC "exp'" #-} getExpires $ clientSessionDuration master
|
let exp' = {-# SCC "exp'" #-} getExpires $ clientSessionDuration master
|
||||||
let rh = {-# SCC "rh" #-} takeWhile (/= ':') $ show $ W.remoteHost req
|
--let rh = {-# SCC "rh" #-} takeWhile (/= ':') $ show $ W.remoteHost req
|
||||||
let host = if sessionIpAddress master then S8.pack rh else ""
|
let host = "" -- FIXME if sessionIpAddress master then S8.pack rh else ""
|
||||||
let session' = {-# SCC "session'" #-}
|
let session' = {-# SCC "session'" #-}
|
||||||
case mkey of
|
case mkey of
|
||||||
Nothing -> []
|
Nothing -> []
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
@ -64,6 +65,7 @@ import Data.Maybe (listToMaybe)
|
|||||||
import qualified Blaze.ByteString.Builder.Html.Utf8 as B
|
import qualified Blaze.ByteString.Builder.Html.Utf8 as B
|
||||||
import Blaze.ByteString.Builder (writeByteString, toLazyByteString)
|
import Blaze.ByteString.Builder (writeByteString, toLazyByteString)
|
||||||
import Blaze.ByteString.Builder.Internal.Write (fromWriteList)
|
import Blaze.ByteString.Builder.Internal.Write (fromWriteList)
|
||||||
|
import Database.Persist.Store (PersistEntityBackend)
|
||||||
|
|
||||||
import Text.Blaze.Renderer.String (renderHtml)
|
import Text.Blaze.Renderer.String (renderHtml)
|
||||||
import qualified Data.ByteString as S
|
import qualified Data.ByteString as S
|
||||||
@ -442,8 +444,9 @@ optionsPersist :: ( YesodPersist master, PersistEntity a
|
|||||||
, PersistQuery (YesodPersistBackend master) (GHandler sub master)
|
, PersistQuery (YesodPersistBackend master) (GHandler sub master)
|
||||||
, PathPiece (Key (YesodPersistBackend master) a)
|
, PathPiece (Key (YesodPersistBackend master) a)
|
||||||
, RenderMessage master msg
|
, RenderMessage master msg
|
||||||
|
, PersistEntityBackend a ~ YesodPersistBackend master
|
||||||
)
|
)
|
||||||
=> [Filter a] -> [SelectOpt a] -> (a -> msg) -> GHandler sub master (OptionList (Entity (YesodPersistBackend master) a))
|
=> [Filter a] -> [SelectOpt a] -> (a -> msg) -> GHandler sub master (OptionList (Entity a))
|
||||||
optionsPersist filts ords toDisplay = fmap mkOptionList $ do
|
optionsPersist filts ords toDisplay = fmap mkOptionList $ do
|
||||||
mr <- getMessageRender
|
mr <- getMessageRender
|
||||||
pairs <- runDB $ selectList filts ords
|
pairs <- runDB $ selectList filts ords
|
||||||
|
|||||||
@ -20,7 +20,7 @@ library
|
|||||||
, hamlet >= 0.10 && < 0.11
|
, hamlet >= 0.10 && < 0.11
|
||||||
, shakespeare-css >= 0.10 && < 0.11
|
, shakespeare-css >= 0.10 && < 0.11
|
||||||
, shakespeare-js >= 0.10 && < 0.11
|
, shakespeare-js >= 0.10 && < 0.11
|
||||||
, persistent >= 0.7 && < 0.8
|
, persistent >= 0.8 && < 0.9
|
||||||
, template-haskell
|
, template-haskell
|
||||||
, transformers >= 0.2.2 && < 0.3
|
, transformers >= 0.2.2 && < 0.3
|
||||||
, data-default >= 0.3 && < 0.4
|
, data-default >= 0.3 && < 0.4
|
||||||
|
|||||||
@ -42,8 +42,9 @@ getBy404 :: ( PersistUnique b m
|
|||||||
, m ~ GHandler sub master
|
, m ~ GHandler sub master
|
||||||
, Monad (b m)
|
, Monad (b m)
|
||||||
, MonadTrans b
|
, MonadTrans b
|
||||||
|
, PersistEntityBackend val ~ b
|
||||||
)
|
)
|
||||||
=> Unique val b -> b m (Entity b val)
|
=> Unique val b -> b m (Entity val)
|
||||||
getBy404 key = do
|
getBy404 key = do
|
||||||
mres <- getBy key
|
mres <- getBy key
|
||||||
case mres of
|
case mres of
|
||||||
|
|||||||
@ -15,8 +15,8 @@ description: Some helpers for using Persistent from Yesod.
|
|||||||
library
|
library
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod-core >= 0.10 && < 0.11
|
, yesod-core >= 0.10 && < 0.11
|
||||||
, persistent >= 0.7 && < 0.8
|
, persistent >= 0.8 && < 0.9
|
||||||
, persistent-template >= 0.7 && < 0.8
|
, persistent-template >= 0.8 && < 0.9
|
||||||
, transformers >= 0.2.2 && < 0.3
|
, transformers >= 0.2.2 && < 0.3
|
||||||
exposed-modules: Yesod.Persist
|
exposed-modules: Yesod.Persist
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|||||||
@ -115,13 +115,10 @@ scaffold = do
|
|||||||
|
|
||||||
packages =
|
packages =
|
||||||
if backend == MongoDB
|
if backend == MongoDB
|
||||||
then " , persistent-mongoDB >= 0.6.1 && < 0.7\n , mongoDB >= 1.1\n , bson >= 0.1.5\n"
|
then " , persistent-mongoDB >= 0.8 && < 0.9\n , mongoDB >= 1.1\n , bson >= 0.1.5\n"
|
||||||
else " , persistent-" ++ backendLower ++ " >= 0.6 && < 0.7"
|
else " , persistent-" ++ backendLower ++ " >= 0.8 && < 0.9"
|
||||||
|
|
||||||
monadControlVersion =
|
monadControlVersion = "== 0.3.*"
|
||||||
if backend == MongoDB
|
|
||||||
then "== 0.2.*"
|
|
||||||
else "== 0.3.*"
|
|
||||||
|
|
||||||
|
|
||||||
let fst3 (x, _, _) = x
|
let fst3 (x, _, _) = x
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user