Merge pull request #551 from tlaitinen/master
401 Unauthorized HTTP status code for JSON-reply login fails and success="true" for JSON-reply
This commit is contained in:
commit
bb5fa38eb2
@ -89,7 +89,7 @@ import Data.Digest.Pure.SHA (sha1, showDigest)
|
|||||||
import Data.Text (Text, pack, unpack, append)
|
import Data.Text (Text, pack, unpack, append)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import System.Random (randomRIO)
|
import System.Random (randomRIO)
|
||||||
|
import Network.HTTP.Types (unauthorized401)
|
||||||
-- | Interface for data type which holds user info. It's just a
|
-- | Interface for data type which holds user info. It's just a
|
||||||
-- collection of getters and setters
|
-- collection of getters and setters
|
||||||
class HashDBUser user where
|
class HashDBUser user where
|
||||||
@ -189,7 +189,7 @@ loginMsg dest msg = selectRep (do
|
|||||||
fmap asHtml $ redirect dest
|
fmap asHtml $ redirect dest
|
||||||
provideRep $ return $ object
|
provideRep $ return $ object
|
||||||
[ "message" .= msg
|
[ "message" .= msg
|
||||||
]) >>= sendResponse
|
]) >>= sendResponseStatus unauthorized401
|
||||||
where
|
where
|
||||||
asHtml :: Html -> Html
|
asHtml :: Html -> Html
|
||||||
asHtml = id
|
asHtml = id
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user