Skip to content
This repository has been archived by the owner on Aug 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #100 from fkammer/feature-stoken-support
Browse files Browse the repository at this point in the history
Add support for secure tokens
  • Loading branch information
mtrias committed Jan 28, 2016
2 parents 3ae66b7 + e1d1871 commit d47f64b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,22 @@ app.controller('myController', ['$scope', 'vcRecaptchaService', function ($scope
}]);
```

Secure Token
------------

If you want to use a secure token pass it along with the site key as an html attribute.

```html
<div
vc-recaptcha
key="'---- YOUR PUBLIC KEY GOES HERE ----'"
stoken="'--- YOUR GENERATED SECURE TOKEN ---'"
></div>
```

Please note that you have to enrypt your token yourself with your private key upfront!
To learn more about secure tokens and how to generate & encrypt them please refer to the [reCAPTCHA Docs](https://developers.google.com/recaptcha/docs/secure_token).


Differences with the old reCaptcha
----------------------------------
Expand Down
6 changes: 4 additions & 2 deletions release/angular-recaptcha.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* angular-recaptcha build:2015-08-26
* angular-recaptcha build:2016-01-19
* https://github.com/vividcortex/angular-recaptcha
* Copyright (c) 2015 VividCortex
* Copyright (c) 2016 VividCortex
**/

/*global angular, Recaptcha */
Expand Down Expand Up @@ -119,6 +119,7 @@
scope: {
response: '=?ngModel',
key: '=',
stoken: '=?',
theme: '=?',
size: '=?',
tabindex: '=?',
Expand Down Expand Up @@ -167,6 +168,7 @@

vcRecaptcha.create(elm[0], key, callback, {

stoken: scope.stoken || attrs.stoken || null,
theme: scope.theme || attrs.theme || null,
tabindex: scope.tabindex || attrs.tabindex || null,
size: scope.size || attrs.size || null
Expand Down
6 changes: 3 additions & 3 deletions release/angular-recaptcha.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
scope: {
response: '=?ngModel',
key: '=',
stoken: '=?',
theme: '=?',
size: '=?',
tabindex: '=?',
Expand Down Expand Up @@ -64,6 +65,7 @@

vcRecaptcha.create(elm[0], key, callback, {

stoken: scope.stoken || attrs.stoken || null,
theme: scope.theme || attrs.theme || null,
tabindex: scope.tabindex || attrs.tabindex || null,
size: scope.size || attrs.size || null
Expand Down

0 comments on commit d47f64b

Please sign in to comment.