yesod-recaptcha2-1.0.2: yesod recaptcha2
Safe HaskellNone
LanguageHaskell2010

Yesod.ReCaptcha2

Synopsis

Documentation

class YesodReCaptcha site where Source #

default key is testing. you should impl reCaptchaSiteKey and reCaptchaSecretKey

Minimal complete definition

Nothing

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.

  1. Function to check the response: reCaptchaInvisible or mReCaptchaInvisible.
  2. Add the following to the code which creates the form:

    (reCaptchaFormId, reCaptchaWidget, reCaptchaButtonAttributes) <-
    reCaptchaInvisibleForm Nothing
  3. 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 #

Arguments

:: YesodReCaptcha site 
=> Maybe Text

The id of the form, a new will be created when Nothing is passed

-> Maybe Text

The javascript to call after a successful captcha, it has to submit the form, a simple one will be generated when Nothing is passed

-> HandlerFor site (Text, WidgetFor site (), [(Text, Text)]) 

generate all required parts (except the check) for a Invisible ReCaptcha