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

[SD-499] update recaptcha key #1404

Merged
merged 2 commits into from
Dec 11, 2024
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
2 changes: 1 addition & 1 deletion packages/nuxt-ripple/server/utils/verifyCaptcha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const verifyCaptcha = async (event: H3Event) => {
logger
)

webform = webformApi.getWebform(formId)
webform = await webformApi.getWebform(formId)
} catch (error) {
throw new ApplicationError(
`Couldn't get webform data, unable to continue because we don't know if a captcha is required`,
Expand Down
15 changes: 7 additions & 8 deletions packages/ripple-tide-webform/mapping/webforms-captcha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ export const getCaptchaSettings = (
webform: ApiWebForm
): MappedCaptchaConfig => {
const scoreThreshold =
webform?.third_party_settings?.tide_webform_captcha?.score_threshold
webform?.third_party_settings?.tide_webform?.score_threshold

const siteIdentifier = camelCase(
(webform?.third_party_settings?.tide_webform_captcha?.captcha_details
?.captcha_id || '') as string
(webform?.third_party_settings?.tide_webform?.captcha_details?.captcha_id ||
'') as string
)

return {
enabled:
webform?.third_party_settings?.tide_webform_captcha?.enable_captcha === 1,
type: webform?.third_party_settings?.tide_webform_captcha
enabled: webform?.third_party_settings?.tide_webform?.enable_captcha === 1,
type: webform?.third_party_settings?.tide_webform
?.captcha_type as CaptchaType,
siteKey: (webform?.third_party_settings?.tide_webform_captcha
?.captcha_details?.site_key || '') as string,
siteKey: (webform?.third_party_settings?.tide_webform?.captcha_details
?.site_key || '') as string,
siteIdentifier,
scoreThreshold:
typeof scoreThreshold === 'number' ? scoreThreshold : undefined
Expand Down
2 changes: 1 addition & 1 deletion packages/ripple-tide-webform/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface ApiWebForm {
form_reset?: boolean
}
third_party_settings?: {
tide_webform_captcha?: ApiCaptchaSettings
tide_webform?: ApiCaptchaSettings
}
}

Expand Down
Loading