improve nonce key code as per @gregwebs' suggestion
This commit is contained in:
parent
344a884656
commit
3775552d87
@ -79,10 +79,12 @@ parseWaiRequest' env session' useNonce gen =
|
|||||||
-- nonceKey present in the session is ignored). If sessions
|
-- nonceKey present in the session is ignored). If sessions
|
||||||
-- are enabled and a session has no nonceKey a new one is
|
-- are enabled and a session has no nonceKey a new one is
|
||||||
-- generated.
|
-- generated.
|
||||||
nonce = case (useNonce, lookup nonceKey session') of
|
nonce = if not useNonce
|
||||||
(False, _) -> Nothing
|
then Nothing
|
||||||
(_, Just x) -> Just $ decodeUtf8With lenientDecode x
|
else Just $ maybe
|
||||||
_ -> Just $ pack $ randomString 10 gen
|
(pack $ randomString 10 gen)
|
||||||
|
(decodeUtf8With lenientDecode)
|
||||||
|
(lookup nonceKey session')
|
||||||
|
|
||||||
addTwoLetters :: ([Text] -> [Text], Set.Set Text) -> [Text] -> [Text]
|
addTwoLetters :: ([Text] -> [Text], Set.Set Text) -> [Text] -> [Text]
|
||||||
addTwoLetters (toAdd, exist) [] =
|
addTwoLetters (toAdd, exist) [] =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user