소스 검색

fix: do not execute recaptcha if no site key

poeti8 5 년 전
부모
커밋
21bd3f1132
2개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  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(() => {