recaptcha

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2019 License: MIT Imports: 8 Imported by: 0

README

go-recaptcha

About

This package handles reCaptcha (API version 3.0) form submissions in Go.

Usage

Install the package in your environment:

go get github.com/hazcod/go-recaptcha

To use it within your own code, import github.com/hazcod/go-recaptcha and call:

recaptcha := Recaptcha{ PrivateKey: "your-recaptcha-private-key" }

Now call recaptcha.Verify(remoteip net.IP, action string, response string, minScore uint) which will return (success bool, err error).

Usage Example

Included with this repo is example.go, a simple HTTP server which creates the reCaptcha form and tests the input.

See the instructions for running the example for more details.

Documentation

Overview

This package verifies reCaptcha v3 (http://www.google.com/recaptcha) responses

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Recaptcha

type Recaptcha struct {
	PrivateKey string
}

main object

func (*Recaptcha) Check

func (r *Recaptcha) Check(remoteip net.IP, action string, response string) (success bool, score float32, err error)

Check : check user IP, captcha subject (= page) and captcha response but return treshold

func (*Recaptcha) Verify

func (r *Recaptcha) Verify(remoteip net.IP, action string, response string, minScore float32) (success bool, err error)

Verify : check user IP, captcha subject (= page) and captcha response

Directories

Path Synopsis
example.go A simple HTTP server which presents a reCaptcha input form and evaulates the result, using the github.com/dpapathanasiou/go-recaptcha package.
example.go A simple HTTP server which presents a reCaptcha input form and evaulates the result, using the github.com/dpapathanasiou/go-recaptcha package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL