Do not quote params in Location header

Also treat the enum field in OPTIONS as an array uniformly
This commit is contained in:
Joe Nelson
2014-12-06 17:42:21 -08:00
parent 42faaa97c9
commit f1ecbec543
6 changed files with 44 additions and 42 deletions
+12 -6
View File
@@ -1,7 +1,7 @@
{-# LANGUAGE QuasiQuotes, ScopedTypeVariables #-}
module Auth where
import qualified Data.Aeson as JSON
import Data.Aeson
import Control.Monad (mzero)
import Control.Applicative ( (<*>), (<$>) )
import Crypto.BCrypt
@@ -16,13 +16,19 @@ data AuthUser = AuthUser {
, userRole :: String
}
instance JSON.FromJSON AuthUser where
parseJSON (JSON.Object v) = AuthUser <$>
v JSON..: "id" <*>
v JSON..: "pass" <*>
v JSON..: "role"
instance FromJSON AuthUser where
parseJSON (Object v) = AuthUser <$>
v .: "id" <*>
v .: "pass" <*>
v .: "role"
parseJSON _ = mzero
instance ToJSON AuthUser where
toJSON u = object [
"id" .= userId u
, "pass" .= userPass u
, "role" .= userRole u ]
type DbRole = Text
data LoginAttempt =