git.iko.soy/typeable/random-token
on master help sign in
[SSO] Authorization pages (#4800)

* SSO login page error handling * wip * wip: reset password support * complete reset password flow * fix ci * add password strength check * shakespeare layout * drop lucid * fix haslex * fix after rebase * drop mustache * fix static * fix servant-blaze version * fix static and templates * move content types to separate module * fix haslex * add logs * add auth assets, remove static * Add caddy static * wip * it works * fix * fix * Update ContentTypes.hs * add deps * try fix * try fix * nits Co-authored-by: Evgenii Akentev <i@ak3n.com>

commit39093be1e5ccb51b9ec6b0da43d2bfc3e94ed796 authorNikita <anisimoff.nikita@gmail.com> dateTue 11 Aug 2020, 11:03 (6 years ago) parentc1b1893
2 files changed+3−10
random-token.cabal+3−4 src/Random/Token.hs−6
random-token.cabal+3−4
@@ -21,9 +21,8 @@ library
2121 , deepseq
2222 , http-api-data
2323 , text
24− if !impl(ghcjs)
25− build-depends: cryptonite
26− , postgresql-simple
24+ , cryptonite
25+ , postgresql-simple
2726 default-language: Haskell2010
2827 default-extensions: CPP
2928 , ConstraintKinds
@@ -101,4 +100,4 @@ test-suite spec
101100 , TypeFamilies
102101 , TypeOperators
103102 , UndecidableInstances
104− , ViewPatterns
103+ , ViewPatterns
src/Random/Token.hs−6
@@ -4,9 +4,7 @@ module Random.Token
44 , tokenToText
55 , asciiToToken
66 , textToToken
7−#ifndef ghcjs_HOST_OS
87 , generateToken
9−#endif
108 ) where
119
1210import Control.DeepSeq
@@ -21,11 +19,9 @@ import Data.Typeable
2119import Test.QuickCheck.Arbitrary
2220import Web.HttpApiData
2321
24−#ifndef ghcjs_HOST_OS
2522import Crypto.Random as R
2623import Database.PostgreSQL.Simple.FromField
2724import Database.PostgreSQL.Simple.ToField
28−#endif
2925
3026-- | 16 bytes lenght random value parametrized by label.
3127newtype Token (a :: k) = Token ByteString
@@ -44,7 +40,6 @@ instance FromJSON (Token a) where
4440instance ToJSON (Token a) where
4541 toJSON = toJSON . tokenToText
4642
47−#ifndef ghcjs_HOST_OS
4843instance forall a. (Typeable (Token a), Typeable a) => FromField (Token a) where
4944 fromField fld bs = do
5045 t <- fromField fld bs
@@ -57,7 +52,6 @@ instance ToField (Token a) where
5752
5853generateToken :: (MonadRandom m) => m (Token a)
5954generateToken = Token <$> R.getRandomBytes 16
60−#endif
6155
6256instance FromHttpApiData (Token a) where
6357 parseQueryParam = first T.pack . textToToken