Pārlūkot izejas kodu

fix: do not execute recaptcha if no site key

poeti8 5 gadi atpakaļ
vecāks
revīzija
21bd3f1132
2 mainītis faili ar 5 papildinājumiem un 2 dzēšanām
  1. 0 1
      client/components/ReCaptcha.tsx
  2. 5 1
      client/components/Shortener.tsx

+ 0 - 1
client/components/ReCaptcha.tsx

@@ -1,5 +1,4 @@
 import { Flex } from "reflexbox/styled-components";
-import styled from "styled-components";
 import getConfig from "next/config";
 import React from "react";
 

+ 5 - 1
client/components/Shortener.tsx

@@ -102,7 +102,11 @@ const Shortener = () => {
     setCopied(false);
     setLoading(true);
 
-    if (process.env.NODE_ENV === "production" && !isAuthenticated) {
+    if (
+      process.env.NODE_ENV === "production" &&
+      !!publicRuntimeConfig.RECAPTCHA_SITE_KEY &&
+      !isAuthenticated
+    ) {
       window.grecaptcha.execute(window.captchaId);
       const getCaptchaToken = () => {
         setTimeout(() => {