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

Commit

Permalink
[release]
Browse files Browse the repository at this point in the history
  • Loading branch information
iambrosi committed Aug 26, 2015
1 parent 324efc2 commit 3ae66b7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-recaptcha",
"version": "2.2.4",
"version": "2.2.5",
"keywords": ["angular", "captcha", "recaptcha", "vividcortex", "human", "form", "validation", "signup", "security", "login"],
"main": "release/angular-recaptcha.js",
"ignore": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-recaptcha",
"version": "2.2.4",
"version": "2.2.5",
"description": "An AngularJS module to ease usage of reCaptcha inside a form",
"author": "VividCortex",
"license": "MIT",
Expand Down
20 changes: 17 additions & 3 deletions release/angular-recaptcha.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* angular-recaptcha build:2015-06-22
* angular-recaptcha build:2015-08-26
* https://github.com/vividcortex/angular-recaptcha
* Copyright (c) 2015 VividCortex
**/
Expand Down Expand Up @@ -133,6 +133,7 @@

scope.widgetId = null;

var sessionTimeout;
var removeCreationListener = scope.$watch('key', function (key) {
if (!key) {
return;
Expand All @@ -154,7 +155,7 @@
});

// captcha session lasts 2 mins after set.
$timeout(function (){
sessionTimeout = $timeout(function (){
if(ctrl){
ctrl.$setValidity('recaptcha',false);
}
Expand All @@ -178,14 +179,27 @@
scope.widgetId = widgetId;
scope.onCreate({widgetId: widgetId});

scope.$on('$destroy', cleanup);
scope.$on('$destroy', destroy);

});

// Remove this listener to avoid creating the widget more than once.
removeCreationListener();
});

function destroy() {
if (ctrl) {
// reset the validity of the form if we were removed
ctrl.$setValidity('recaptcha', null);
}
if (sessionTimeout) {
// don't trigger the session timeout if we are no longer active
$timeout.cancel(sessionTimeout);
sessionTimeout = null;
}
cleanup();
}

function cleanup(){
// removes elements reCaptcha added.
angular.element($document[0].querySelectorAll('.pls-container')).parent().remove();
Expand Down
4 changes: 2 additions & 2 deletions release/angular-recaptcha.min.js

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

0 comments on commit 3ae66b7

Please sign in to comment.