mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-14 21:40:55 -05:00
687b56f18e
[web] Reset recaptcha every time GitOrigin-RevId: 6db3571ad6dad3611c748a2d92dce47002a16a77
33 lines
793 B
TypeScript
33 lines
793 B
TypeScript
import ReCAPTCHA from 'react-google-recaptcha'
|
|
import getMeta from '@/utils/meta'
|
|
import { ExposedSettings } from '../../../../types/exposed-settings'
|
|
|
|
interface ReCaptcha2Props
|
|
extends Pick<React.ComponentProps<typeof ReCAPTCHA>, 'onChange'> {
|
|
page: keyof ExposedSettings['recaptchaDisabled']
|
|
recaptchaRef: React.LegacyRef<ReCAPTCHA>
|
|
}
|
|
|
|
export function ReCaptcha2({
|
|
page: site,
|
|
onChange,
|
|
recaptchaRef,
|
|
}: ReCaptcha2Props) {
|
|
const { recaptchaSiteKey, recaptchaDisabled } = getMeta('ol-ExposedSettings')
|
|
|
|
if (!recaptchaSiteKey) {
|
|
return null
|
|
}
|
|
if (site && recaptchaDisabled[site]) {
|
|
return null
|
|
}
|
|
return (
|
|
<ReCAPTCHA
|
|
ref={recaptchaRef}
|
|
size="invisible"
|
|
sitekey={recaptchaSiteKey}
|
|
onChange={onChange}
|
|
badge="inline"
|
|
/>
|
|
)
|
|
}
|