Merge pull request #4604 from appsmithorg/fix/4362-recaptcha-field-unexpected-data-types
Fix/4362 recaptcha field unexpected data types
This commit is contained in:
commit
e1fb11b27c
|
|
@ -180,8 +180,25 @@ function RecaptchaComponent(
|
|||
});
|
||||
props.onClick && props.onClick(event);
|
||||
}
|
||||
|
||||
// Check if a string is a valid JSON string
|
||||
const checkValidJson = (inputString: string): boolean => {
|
||||
try {
|
||||
JSON.parse(inputString);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
let validGoogleRecaptchaKey = props.googleRecaptchaKey;
|
||||
|
||||
if (validGoogleRecaptchaKey && checkValidJson(validGoogleRecaptchaKey)) {
|
||||
validGoogleRecaptchaKey = undefined;
|
||||
}
|
||||
|
||||
const status = useScript(
|
||||
`https://www.google.com/recaptcha/api.js?render=${props.googleRecaptchaKey}`,
|
||||
`https://www.google.com/recaptcha/api.js?render=${validGoogleRecaptchaKey}`,
|
||||
);
|
||||
return (
|
||||
<div
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user