Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class YesodAuth site => YesodReCaptcha site where
- reCaptchaSiteKey :: HandlerFor site Text
- reCaptchaSecretKey :: HandlerFor site Text
- reCaptchaLanguage :: HandlerFor site (Maybe Text)
- reCaptcha :: YesodReCaptcha site => AForm (HandlerFor site) ()
- mReCaptcha :: YesodReCaptcha site => MForm (HandlerFor site) (FormResult (), [FieldView site])
- reCaptchaInvisible :: YesodReCaptcha site => AForm (HandlerFor site) ()
- mReCaptchaInvisible :: YesodReCaptcha site => MForm (HandlerFor site) (FormResult ())
- reCaptchaInvisibleForm :: YesodReCaptcha site => Maybe Text -> Maybe Text -> HandlerFor site (Text, WidgetFor site (), [(Text, Text)])
Documentation
class YesodAuth site => YesodReCaptcha site where Source #
default key is testing. you should impl reCaptchaSiteKey and reCaptchaSecretKey
Nothing
reCaptchaSiteKey :: HandlerFor site Text Source #
reCaptchaSecretKey :: HandlerFor site Text Source #
reCaptchaLanguage :: HandlerFor site (Maybe Text) Source #
with specific language from https://developers.google.com/recaptcha/docs/language
reCaptchaLanguage = pure (Just "ru")
ReCaptcha V2
reCaptcha :: YesodReCaptcha site => AForm (HandlerFor site) () Source #
for Applicative style form
mReCaptcha :: YesodReCaptcha site => MForm (HandlerFor site) (FormResult (), [FieldView site]) Source #
for Monadic style form
Invisible ReCaptcha
The Invisible ReCaptcha is not as easy as the V2.
- Function to check the response:
reCaptchaInvisible
ormReCaptchaInvisible
. Add the following to the code which creates the form:
(reCaptchaFormId, reCaptchaWidget, reCaptchaButtonAttributes) <- reCaptchaInvisibleForm Nothing
Add the id to the form, class and attributes to the button and the widget somewhere. Example:
<form ##{reCaptchaFormId} method=post action=@{route} enctype=#{enctype}> ^{widget} ^{reCaptchaWidget} <button .g-recaptcha *{reCaptchaButtonAttributes}> Submit
reCaptchaInvisible :: YesodReCaptcha site => AForm (HandlerFor site) () Source #
check for Applicative style form
mReCaptchaInvisible :: YesodReCaptcha site => MForm (HandlerFor site) (FormResult ()) Source #
check for Monadic style form
reCaptchaInvisibleForm Source #
:: YesodReCaptcha site | |
=> Maybe Text | The id of the form, a new will be created when |
-> Maybe Text | The javascript to call after a successful captcha,
it has to submit the form, a simple one will be generated when |
-> HandlerFor site (Text, WidgetFor site (), [(Text, Text)]) |
generate all required parts (except the check) for a Invisible ReCaptcha