Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
iamthechad committed Mar 5, 2013
1 parent 2d8f9f3 commit 1fc914f
Showing 1 changed file with 48 additions and 8 deletions.
56 changes: 48 additions & 8 deletions README.md
Expand Up @@ -4,17 +4,49 @@ This plugin is designed to make using the ReCaptcha and Mailhide services within

# Installation

This plugin is easily installed from the Grails plugin repository.
Add the following to your `grails-app/conf/BuildConfig.groovy`

plugins {
compile ':recaptcha:0.6.2'
}

Upon installation, run `grails recaptcha-quickstart` to create the skeleton configuration. The quickstart has two targets: `integrated` or `standalone`, depending on where you'd like the configuration to live.

Issue this command to install: `grails install-plugin recaptcha`.
## Integrated Configuration
Integrated configuration adds the following to the end of your `Config.groovy` file:

# Usage - ReCaptcha
// Added by the Recaptcha plugin:
recaptcha {
// These keys are generated by the ReCaptcha service
publicKey = ""
privateKey = ""

The plugin is simple to use. In order to use it, there are four basic steps:
// Include the noscript tags in the generated captcha
includeNoScript = true

## Edit the Configuration
// Force language change. See this for more: http://code.google.com/p/recaptcha/issues/detail?id=133
forceLanguageInURL = false

// Set to false to disable the display of captcha
enabled = true

// Communicate using HTTPS
useSecureAPI = true
}

mailhide {
// Generated by the Mailhide service
publicKey = ""
privateKey = ""
}

This configuration can be modified to mimic the standalone if there is a need for different behavior depending on the current environment.

The plugin creates a file called `RecaptchaConfig.groovy` in `grails-app/conf` that has the following content:
## Standalone Configuration
Standlaone configuration creates a file called `RecaptchaConfig.groovy` in `grails-app/conf` with the following content:

recaptcha {
// These keys are generated by the ReCaptcha service
Expand Down Expand Up @@ -53,7 +85,14 @@ The plugin creates a file called `RecaptchaConfig.groovy` in `grails-app/conf
}
}
}
The values are pretty self-explanatory, and match with values used by the ReCaptcha service. You must enter your public and private ReCaptcha keys, or errors will be thrown when trying to display a captcha. Note that you can override values within the `environments` closure.

# Usage - ReCaptcha

The plugin is simple to use. In order to use it, there are four basic steps:

## Edit the Configuration

The configuration values are pretty self-explanatory, and match with values used by the ReCaptcha service. You must enter your public and private ReCaptcha keys, or errors will be thrown when trying to display a captcha.

## Use the Tag Library

Expand All @@ -62,7 +101,7 @@ The plugin includes four ReCaptcha tags: `<recaptcha:ifEnabled>`, `<recaptcha:i
* The `<recaptcha:ifEnabled>` tag is a simple utility tag that will render the contents of the tag if the captcha is enabled in `RecaptchaConfig.groovy`.
* The `<recaptcha:ifDisabled>` tag is a simple utility tag that will render the contents of the tag if the captcha is disabled in `RecaptchaConfig.groovy`.
* The `<recaptcha:recaptcha>` tag is responsible for generating the correct HTML output to display the captcha. It supports four attributes: "theme", "lang", "tabindex", and "custom\_theme\_widget". These attributes map directly to the values that can be set according to the ReCaptcha API. See the [ReCaptcha Client Guide](https://developers.google.com/recaptcha/intro) for more details.
* The `<recaptcha:recaptchaAjax>` tag is responsible for creating the correct HTML output to display the captcha in an AJAX manner. The tag creates a JavaScript method called `showRecaptcha` that takes an element name as a parameter. This elemtn will contain the generated ReCaptcha widget. This tag supports the same attributes as the `<recaptcha:recaptcha>` tag.
* The `<recaptcha:recaptchaAjax>` tag is responsible for creating the correct HTML output to display the captcha in an AJAX manner. The tag creates a JavaScript method called `showRecaptcha` that takes an element name as a parameter. This element will contain the generated ReCaptcha widget. This tag supports the same attributes as the `<recaptcha:recaptcha>` tag.
* The `<recaptcha:ifFailed>` tag will render its contents if the previous validation failed. Some ReCaptcha themes, like "clean", do not display error messages and require the developer to show an error message. Use this tag if you're using one of these themes.

## Verify the Captcha
Expand Down Expand Up @@ -263,6 +302,7 @@ will create:

### CHANGELOG

* 0.6.2 Remove spurious `println` left over. Change install behavior to not create `RecaptchaConfig.groovy` in `_Install.groovy`. Add new script `recaptcha-quickstart` to handle creation of required configuration.
* 0.6.0 Add the ability to display the widget using AJAX. Change plugin to require Grails 2.0 at a minimum.
* 0.5.3 Add the ability to force a different language to be displayed.
* 0.5.1 & 0.5.2 Update to use the new ReCaptcha URLs.
Expand Down

0 comments on commit 1fc914f

Please sign in to comment.