From a85dd94afbf5a34d7f7082019ee9acd2e96c0701 Mon Sep 17 00:00:00 2001 From: Frederik Kammer Date: Tue, 19 Jan 2016 11:33:06 +0100 Subject: [PATCH 1/3] Adds support for Secure Token --- src/directive.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/directive.js b/src/directive.js index e6ce40f..0237f4a 100644 --- a/src/directive.js +++ b/src/directive.js @@ -16,6 +16,7 @@ scope: { response: '=?ngModel', key: '=', + stoken: '=?', theme: '=?', size: '=?', tabindex: '=?', @@ -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 From bb3a818aed13314f8496b75fe1897eec3294f358 Mon Sep 17 00:00:00 2001 From: Frederik Kammer Date: Tue, 19 Jan 2016 11:44:11 +0100 Subject: [PATCH 2/3] Updated README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index c7f6a9d..02a1583 100644 --- a/README.md +++ b/README.md @@ -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 +
+``` + +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 ---------------------------------- From e1d187152c2ee44fd36283aeab626a3386d4581e Mon Sep 17 00:00:00 2001 From: Frederik Kammer Date: Tue, 19 Jan 2016 13:11:22 +0100 Subject: [PATCH 3/3] Build --- release/angular-recaptcha.js | 6 ++++-- release/angular-recaptcha.min.js | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/release/angular-recaptcha.js b/release/angular-recaptcha.js index f3efcb2..b0bc6e8 100644 --- a/release/angular-recaptcha.js +++ b/release/angular-recaptcha.js @@ -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 */ @@ -119,6 +119,7 @@ scope: { response: '=?ngModel', key: '=', + stoken: '=?', theme: '=?', size: '=?', tabindex: '=?', @@ -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 diff --git a/release/angular-recaptcha.min.js b/release/angular-recaptcha.min.js index a4b8c04..84549d7 100644 --- a/release/angular-recaptcha.min.js +++ b/release/angular-recaptcha.min.js @@ -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 **/ -!function(a){"use strict";a.module("vcRecaptcha",[])}(angular),function(a){"use strict";var b=a.module("vcRecaptcha");b.service("vcRecaptchaService",["$window","$q",function(b,c){function d(){return f?c.when(f):h}function e(){if(!f)throw new Error("reCaptcha has not been loaded yet.")}var f,g=c.defer(),h=g.promise;return b.vcRecaptchaApiLoaded=function(){f=b.grecaptcha,g.resolve(f)},a.isDefined(b.grecaptcha)&&b.vcRecaptchaApiLoaded(),{create:function(a,b,c,e){return e.callback=c,e.sitekey=b,d().then(function(b){return b.render(a,e)})},reload:function(a){e(),f.reset(a)},getResponse:function(a){return e(),f.getResponse(a)}}}])}(angular),function(a){"use strict";function b(){throw new Error('You need to set the "key" attribute to your public reCaptcha key. If you don\'t have a key, please get one from https://www.google.com/recaptcha/admin/create')}var c=a.module("vcRecaptcha");c.directive("vcRecaptcha",["$document","$timeout","vcRecaptchaService",function(a,c,d){return{restrict:"A",require:"?^^form",scope:{response:"=?ngModel",key:"=",theme:"=?",size:"=?",tabindex:"=?",onCreate:"&",onSuccess:"&",onExpire:"&"},link:function(e,f,g,h){function i(){h&&h.$setValidity("recaptcha",null),k&&(c.cancel(k),k=null),j()}function j(){angular.element(a[0].querySelectorAll(".pls-container")).parent().remove()}g.hasOwnProperty("key")||b(),e.widgetId=null;var k,l=e.$watch("key",function(a){if(a){40!==a.length&&b();var j=function(a){c(function(){h&&h.$setValidity("recaptcha",!0),e.response=a,e.onSuccess({response:a,widgetId:e.widgetId})}),k=c(function(){h&&h.$setValidity("recaptcha",!1),e.response="",e.onExpire({widgetId:e.widgetId})},12e4)};d.create(f[0],a,j,{theme:e.theme||g.theme||null,tabindex:e.tabindex||g.tabindex||null,size:e.size||g.size||null}).then(function(a){h&&h.$setValidity("recaptcha",!1),e.widgetId=a,e.onCreate({widgetId:a}),e.$on("$destroy",i)}),l()}})}}}])}(angular); \ No newline at end of file +!function(a){"use strict";a.module("vcRecaptcha",[])}(angular),function(a){"use strict";var b=a.module("vcRecaptcha");b.service("vcRecaptchaService",["$window","$q",function(b,c){function d(){return f?c.when(f):h}function e(){if(!f)throw new Error("reCaptcha has not been loaded yet.")}var f,g=c.defer(),h=g.promise;return b.vcRecaptchaApiLoaded=function(){f=b.grecaptcha,g.resolve(f)},a.isDefined(b.grecaptcha)&&b.vcRecaptchaApiLoaded(),{create:function(a,b,c,e){return e.callback=c,e.sitekey=b,d().then(function(b){return b.render(a,e)})},reload:function(a){e(),f.reset(a)},getResponse:function(a){return e(),f.getResponse(a)}}}])}(angular),function(a){"use strict";function b(){throw new Error('You need to set the "key" attribute to your public reCaptcha key. If you don\'t have a key, please get one from https://www.google.com/recaptcha/admin/create')}var c=a.module("vcRecaptcha");c.directive("vcRecaptcha",["$document","$timeout","vcRecaptchaService",function(a,c,d){return{restrict:"A",require:"?^^form",scope:{response:"=?ngModel",key:"=",stoken:"=?",theme:"=?",size:"=?",tabindex:"=?",onCreate:"&",onSuccess:"&",onExpire:"&"},link:function(e,f,g,h){function i(){h&&h.$setValidity("recaptcha",null),k&&(c.cancel(k),k=null),j()}function j(){angular.element(a[0].querySelectorAll(".pls-container")).parent().remove()}g.hasOwnProperty("key")||b(),e.widgetId=null;var k,l=e.$watch("key",function(a){if(a){40!==a.length&&b();var j=function(a){c(function(){h&&h.$setValidity("recaptcha",!0),e.response=a,e.onSuccess({response:a,widgetId:e.widgetId})}),k=c(function(){h&&h.$setValidity("recaptcha",!1),e.response="",e.onExpire({widgetId:e.widgetId})},12e4)};d.create(f[0],a,j,{stoken:e.stoken||g.stoken||null,theme:e.theme||g.theme||null,tabindex:e.tabindex||g.tabindex||null,size:e.size||g.size||null}).then(function(a){h&&h.$setValidity("recaptcha",!1),e.widgetId=a,e.onCreate({widgetId:a}),e.$on("$destroy",i)}),l()}})}}}])}(angular); \ No newline at end of file