Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update for latest version of aeson

  • Loading branch information...
commit e749f83fb90960ae2d00a0df9bf70d4c184edb9a 1 parent a65c2aa
@mightybyte mightybyte authored
View
2  project_template/tutorial/foo.cabal
@@ -22,7 +22,7 @@ Executable projname
bytestring >= 0.9.1 && < 0.11,
MonadCatchIO-transformers >= 0.2.1 && < 0.4,
mtl >= 2 && < 3,
- snap >= 0.11 && < 0.13,
+ snap >= 0.11 && < 0.14,
snap-core >= 0.9 && < 0.11,
snap-server >= 0.9 && < 0.11
View
2  snap.cabal
@@ -144,7 +144,7 @@ Library
build-depends:
MonadCatchIO-transformers >= 0.2 && < 0.4,
- aeson >= 0.6 && < 0.7,
+ aeson >= 0.6 && < 0.8,
attoparsec >= 0.10 && < 0.12,
bytestring >= 0.9.1 && < 0.11,
cereal >= 0.3 && < 0.5,
View
17 src/Snap/Snaplet/Auth/Types.hs
@@ -18,6 +18,7 @@ import qualified Data.HashMap.Strict as HM
import Data.Hashable (Hashable)
import Data.Time
import Data.Text (Text)
+import Data.Text.Encoding
import Data.Typeable
import Snap.Snaplet
@@ -268,8 +269,8 @@ instance ToJSON AuthUser where
, "locked_until" .= userLockedOutUntil u
, "current_login_at" .= userCurrentLoginAt u
, "last_login_at" .= userLastLoginAt u
- , "current_ip" .= userCurrentLoginIp u
- , "last_ip" .= userLastLoginIp u
+ , "current_ip" .= fmap decodeUtf8 (userCurrentLoginIp u)
+ , "last_ip" .= fmap decodeUtf8 (userLastLoginIp u)
, "created_at" .= userCreatedAt u
, "updated_at" .= userUpdatedAt u
, "reset_token" .= userResetToken u
@@ -294,8 +295,8 @@ instance FromJSON AuthUser where
<*> v .: "locked_until"
<*> v .: "current_login_at"
<*> v .: "last_login_at"
- <*> v .: "current_ip"
- <*> v .: "last_ip"
+ <*> fmap (fmap encodeUtf8) (v .: "current_ip")
+ <*> fmap (fmap encodeUtf8) (v .: "last_ip")
<*> v .: "created_at"
<*> v .: "updated_at"
<*> v .: "reset_token"
@@ -307,21 +308,21 @@ instance FromJSON AuthUser where
------------------------------------------------------------------------------
instance ToJSON Password where
- toJSON (Encrypted x) = toJSON x
+ toJSON (Encrypted x) = toJSON $ decodeUtf8 x
toJSON (ClearText _) =
error "ClearText passwords can't be serialized into JSON"
------------------------------------------------------------------------------
instance FromJSON Password where
- parseJSON = fmap Encrypted . parseJSON
+ parseJSON = fmap (Encrypted . encodeUtf8) . parseJSON
------------------------------------------------------------------------------
instance ToJSON Role where
- toJSON (Role x) = toJSON x
+ toJSON (Role x) = toJSON $ decodeUtf8 x
------------------------------------------------------------------------------
instance FromJSON Role where
- parseJSON = fmap Role . parseJSON
+ parseJSON = fmap (Role . encodeUtf8) . parseJSON
View
6 test/snap-testsuite.cabal
@@ -26,7 +26,7 @@ Executable snap-testsuite
unix >= 2.2.0.0 && < 2.7,
MonadCatchIO-transformers >= 0.2 && < 0.4,
- aeson >= 0.6 && < 0.7,
+ aeson >= 0.6 && < 0.8,
attoparsec >= 0.10 && < 0.12,
bytestring >= 0.9.1 && < 0.11,
cereal >= 0.3 && < 0.5,
@@ -98,7 +98,7 @@ Executable app
build-depends:
MonadCatchIO-transformers >= 0.2 && < 0.4,
- aeson >= 0.6 && < 0.7,
+ aeson >= 0.6 && < 0.8,
attoparsec >= 0.10 && < 0.12,
bytestring >= 0.9.1 && < 0.11,
cereal >= 0.3 && < 0.5,
@@ -180,7 +180,7 @@ Executable nesttest
unix >= 2.2.0.0 && < 2.7,
MonadCatchIO-transformers >= 0.2 && < 0.4,
- aeson >= 0.6 && < 0.7,
+ aeson >= 0.6 && < 0.8,
attoparsec >= 0.10 && < 0.12,
bytestring >= 0.9.1 && < 0.11,
cereal >= 0.3 && < 0.5,
Please sign in to comment.
Something went wrong with that request. Please try again.