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

Commit 3ae66b7

Browse files
committed
[release]
1 parent 324efc2 commit 3ae66b7

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-recaptcha",
3-
"version": "2.2.4",
3+
"version": "2.2.5",
44
"keywords": ["angular", "captcha", "recaptcha", "vividcortex", "human", "form", "validation", "signup", "security", "login"],
55
"main": "release/angular-recaptcha.js",
66
"ignore": [

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-recaptcha",
3-
"version": "2.2.4",
3+
"version": "2.2.5",
44
"description": "An AngularJS module to ease usage of reCaptcha inside a form",
55
"author": "VividCortex",
66
"license": "MIT",

release/angular-recaptcha.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* angular-recaptcha build:2015-06-22
2+
* angular-recaptcha build:2015-08-26
33
* https://github.com/vividcortex/angular-recaptcha
44
* Copyright (c) 2015 VividCortex
55
**/
@@ -133,6 +133,7 @@
133133

134134
scope.widgetId = null;
135135

136+
var sessionTimeout;
136137
var removeCreationListener = scope.$watch('key', function (key) {
137138
if (!key) {
138139
return;
@@ -154,7 +155,7 @@
154155
});
155156

156157
// captcha session lasts 2 mins after set.
157-
$timeout(function (){
158+
sessionTimeout = $timeout(function (){
158159
if(ctrl){
159160
ctrl.$setValidity('recaptcha',false);
160161
}
@@ -178,14 +179,27 @@
178179
scope.widgetId = widgetId;
179180
scope.onCreate({widgetId: widgetId});
180181

181-
scope.$on('$destroy', cleanup);
182+
scope.$on('$destroy', destroy);
182183

183184
});
184185

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

190+
function destroy() {
191+
if (ctrl) {
192+
// reset the validity of the form if we were removed
193+
ctrl.$setValidity('recaptcha', null);
194+
}
195+
if (sessionTimeout) {
196+
// don't trigger the session timeout if we are no longer active
197+
$timeout.cancel(sessionTimeout);
198+
sessionTimeout = null;
199+
}
200+
cleanup();
201+
}
202+
189203
function cleanup(){
190204
// removes elements reCaptcha added.
191205
angular.element($document[0].querySelectorAll('.pls-container')).parent().remove();

release/angular-recaptcha.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)