Skip to content

Commit

Permalink
fix(submissions): remove captcha dependence on feature toggle (#2143)
Browse files Browse the repository at this point in the history
  • Loading branch information
mantariksh authored Jun 11, 2021
1 parent bdad7d3 commit e62494e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<div
vc-recaptcha
key="captchaService.publicKey"
ng-if="captchaService.create(feature.captcha) && form.hasCaptcha && !disableSubmitButton"
ng-if="form.hasCaptcha && !disableSubmitButton"
size="invisible"
on-create="captchaService.setWidget(widgetId)"
on-success="captchaService.onSuccess(response, submitForm)"
Expand Down
28 changes: 5 additions & 23 deletions src/public/modules/forms/services/captcha.client.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,6 @@ function captchaService($window, vcRecaptchaService, Toastr, GTag) {
*/
this.widgetId = null

/**
* Flag indicating if captcha feature is enabled on app
*/
this.enabled = false

/**
* Set enabled flag
* @param {Boolean} enabled
*/
this.create = function (enabled) {
// We cannot use setWidget() as an indication that captcha is enabled/disabled because setWidget() will not be called
// when captcha is enabled but captcha is blocked
this.enabled = enabled
return this.enabled
}

/**
* Set widgetId
* @param {String} widgetId
Expand Down Expand Up @@ -77,20 +61,18 @@ function captchaService($window, vcRecaptchaService, Toastr, GTag) {
}

/**
* Expire captcha if captcha enabled
* Expire captcha
*/
this.expire = function () {
if (this.enabled) {
vcRecaptchaService.reload(this.widgetId)
this.response = null
}
vcRecaptchaService.reload(this.widgetId)
this.response = null
}

/**
* Check if response has been set, assuming captcha is enabled
* Check if response has been set
*/
this.isValid = function () {
if (this.response || !this.enabled) {
if (this.response) {
return true
} else {
return false
Expand Down

0 comments on commit e62494e

Please sign in to comment.