Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(submissions): remove captcha dependence on feature toggle #2143

Merged
merged 1 commit into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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