The cl-recaptcha Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-recaptcha Reference Manual

This is the cl-recaptcha Reference Manual, version 2.0.0, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 11:21:11 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

cl-recaptcha

cl-recaptcha is a simple interconnection between recaptcha.com and common-lisp. It can be used for the trivial usage of the recaptcha service.

dependencies

cl-recaptcha requires cl-ppcre, flexi-streams, jsown and drakma. This library is available via quicklisp.

(ql:quickload :cl-recaptcha)

usage

The simplest way to use cl-recaptcha is to get a public and private key from "https://www.google.com/recaptcha/intro/index.html". Set the key in cl-recaptcha, insert the needed code in your site and ask cl-recaptcha for verification. All this should look somewhat like this:

(setf cl-recaptcha:*site-key* "your-site-key")
(setf cl-recaptcha:*secret-key* "your-secret-key")

In the source of the page, insert a call to challenge where you want to have your recaptcha inserted.

;; Javascript enabled version
(challenge-js)

or

;; Javascript with a noscript tag
(challenge-ns)

Assuming you get your post-vars by (get-post-var "varname") and the ip of the user by (get-ip-address), you can check the validity of the entry of the user by running:

(verify-captcha (get-post-var "g-recaptcha-response") (get-ip-address))

Please note that the ip address is an optional parameter, as it is not required by the recaptcha API call itself.

The verify-captcha function will return T on success and nil on failure. The second value it returns specifies the reason why the challenge was rejected. The result is returned as a list, however the error is usually a single string.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-recaptcha

Maintainer

Aad Versteden <madnificent@gmail.com>

Author

Aad Versteden <madnificent@gmail.com>

License

MIT

Description

Trivial support for the recaptcha service

Version

2.0.0

Dependencies
Source

cl-recaptcha.asd (file)

Component

code.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 cl-recaptcha.asd

Location

cl-recaptcha.asd

Systems

cl-recaptcha (system)

Packages

cl-recaptcha.sysdef


Previous: , Up: Lisp files   [Contents][Index]

3.1.2 cl-recaptcha/code.lisp

Parent

cl-recaptcha (system)

Location

code.lisp

Packages

cl-recaptcha

Exported Definitions
Internal Definitions

*captcha-verify-url* (special variable)


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 cl-recaptcha.sysdef

Source

cl-recaptcha.asd

Use List

Previous: , Up: Packages   [Contents][Index]

4.2 cl-recaptcha

Source

code.lisp (file)

Use List
Exported Definitions
Internal Definitions

*captcha-verify-url* (special variable)


Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *recaptcha-header-script-tag*

The source of the javascript file, the standard value comes from recaptcha itself and should be available in any case

Package

cl-recaptcha

Source

code.lisp (file)

Special Variable: *secret-key*

Secret key for the recaptcha service. This is mainly used server side to validate the challenge resopnse. Register at https://www.google.com/recaptcha/intro/index.html

Package

cl-recaptcha

Source

code.lisp (file)

Special Variable: *site-key*

Site key for the recaptcha service. This is public facing and will appear in the div element that holds the recaptcha form. Register at https://www.google.com/recaptcha/intro/index.html

Package

cl-recaptcha

Source

code.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: challenge-js &key SITE-KEY THEME CALLBACK EXPIRED-CALLBACK

This is the javascript-enabled version of the challenge, recaptcha advises you to use this.

Package

cl-recaptcha

Source

code.lisp (file)

Function: challenge-ns &key SITE-KEY THEME CALLBACK EXPIRED-CALLBACK

This is the javascript-disabled version of the challenge. Google does not recommend it’s use if Javascript is a requirement for your site

Package

cl-recaptcha

Source

code.lisp (file)

Function: verify-captcha G-RECAPTCHA-RESPONSE &optional REMOTE-IP &key SECRET-KEY

Verifies the result the user gave. There are two values returned. The first indicates the success or failure, the second indicates the error code the captcha-server gave. Errors are returned in a list (just as the original JSON response returns errors in an array).

Package

cl-recaptcha

Source

code.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *captcha-verify-url*

This is the URL that will be used to verify the result of the captcha. This is the one recaptcha provides

Package

cl-recaptcha

Source

code.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-recaptcha.asd: The cl-recaptcha<dot>asd file
cl-recaptcha/code.lisp: The cl-recaptcha/code<dot>lisp file

F
File, Lisp, cl-recaptcha.asd: The cl-recaptcha<dot>asd file
File, Lisp, cl-recaptcha/code.lisp: The cl-recaptcha/code<dot>lisp file

L
Lisp File, cl-recaptcha.asd: The cl-recaptcha<dot>asd file
Lisp File, cl-recaptcha/code.lisp: The cl-recaptcha/code<dot>lisp file

Jump to:   C   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   F   V  
Index Entry  Section

C
challenge-js: Exported functions
challenge-ns: Exported functions

F
Function, challenge-js: Exported functions
Function, challenge-ns: Exported functions
Function, verify-captcha: Exported functions

V
verify-captcha: Exported functions

Jump to:   C   F   V  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*captcha-verify-url*: Internal special variables
*recaptcha-header-script-tag*: Exported special variables
*secret-key*: Exported special variables
*site-key*: Exported special variables

S
Special Variable, *captcha-verify-url*: Internal special variables
Special Variable, *recaptcha-header-script-tag*: Exported special variables
Special Variable, *secret-key*: Exported special variables
Special Variable, *site-key*: Exported special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   S  
Index Entry  Section

C
cl-recaptcha: The cl-recaptcha system
cl-recaptcha: The cl-recaptcha package
cl-recaptcha.sysdef: The cl-recaptcha<dot>sysdef package

P
Package, cl-recaptcha: The cl-recaptcha package
Package, cl-recaptcha.sysdef: The cl-recaptcha<dot>sysdef package

S
System, cl-recaptcha: The cl-recaptcha system

Jump to:   C   P   S