packages feed

yesod-recaptcha2 0.2.0 → 0.2.1

raw patch · 3 files changed

+13/−11 lines, 3 filesdep −textPVP ok

version bump matches the API change (PVP)

Dependencies removed: text

API changes (from Hackage documentation)

Files

README.md view
@@ -1,5 +1,7 @@ # yesod-recaptcha2 +![Hackage](https://img.shields.io/hackage/v/yesod-recaptcha2.svg)+ ~~~hs import Yesod.ReCaptcha2 ~~~
src/Yesod/ReCaptcha2.hs view
@@ -3,11 +3,9 @@ {-# LANGUAGE NamedFieldPuns    #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes       #-}-{-# LANGUAGE TemplateHaskell   #-} module Yesod.ReCaptcha2 (YesodReCaptcha(..), reCaptcha, mReCaptcha) where  import           ClassyPrelude.Yesod-import           Data.Text           (append) import           Network.HTTP.Simple import           Yesod.Auth @@ -20,7 +18,10 @@     reCaptchaLanguage :: HandlerT site IO (Maybe Text)     reCaptchaLanguage = pure Nothing -data SiteverifyResponse = SiteverifyResponse { success :: Bool }+newtype SiteverifyResponse+    = SiteverifyResponse+    { success :: Bool+    }     deriving (Eq, Ord, Read, Show, Generic, FromJSON, ToJSON)  -- | for Applicative style form@@ -35,10 +36,10 @@   where formResult = do             postParam <- lookupPostParam "g-recaptcha-response"             case postParam of-                Nothing -> return $ FormMissing+                Nothing -> return FormMissing                 Just response -> do                     secret <- reCaptchaSecretKey-                    s@SiteverifyResponse { success } <- liftIO $ do+                    SiteverifyResponse{success} <- liftIO $ do                         req <- parseRequest "POST https://www.google.com/recaptcha/api/siteverify"                         res <- httpJSON $                             setRequestBodyURLEncoded@@ -52,12 +53,12 @@             , fvTooltip = Nothing             , fvId = ""             , fvInput = do-                    language <- handlerToWidget reCaptchaLanguage-                    case language of+                    mReCaptchaLanguage <- handlerToWidget reCaptchaLanguage+                    case mReCaptchaLanguage of                       Nothing ->                         addScriptRemote "https://www.google.com/recaptcha/api.js"-                      Just language ->-                        addScriptRemote $ append "https://www.google.com/recaptcha/api.js?hl=" language+                      Just hl ->+                        addScriptRemote $ "https://www.google.com/recaptcha/api.js?hl=" <> hl                     siteKey <- handlerToWidget reCaptchaSiteKey                     [whamlet|<div .g-recaptcha data-sitekey=#{siteKey}>|]             , fvErrors = Nothing
yesod-recaptcha2.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           yesod-recaptcha2-version:        0.2.0+version:        0.2.1 synopsis:       yesod recaptcha2 description:    recaptcha2 for yesod-form category:       Web@@ -32,7 +32,6 @@     , classy-prelude-yesod     , http-conduit     , yesod-auth-    , text   exposed-modules:       Yesod.ReCaptcha2   default-language: Haskell2010