Explorar o código

fix: do not execute recaptcha if no site key

poeti8 %!s(int64=5) %!d(string=hai) anos
pai
achega
21bd3f1132
Modificáronse 2 ficheiros con 5 adicións e 2 borrados
  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(() => {