Skip to content

Commit

Permalink
moved variables to env
Browse files Browse the repository at this point in the history
  • Loading branch information
VijeshVS committed Jun 2, 2024
1 parent 660009f commit 5a4926d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const LoginPage = () => {
const router = useRouter();
const [loading, setLoading] = useState(true);
const [token,setToken] = useState<string>("")
const site_id = process.env.NEXT_PUBLIC_CAPTCHA_SITE_KEY || ""

const { data } = useSession();
useEffect(() => {
Expand Down Expand Up @@ -76,7 +77,7 @@ const LoginPage = () => {

<Turnstile onSuccess={(token) => {
setToken(token)
}} siteKey='0x4AAAAAAAbu8T-y1tAsroOZ' />
}} siteKey={site_id} />

<Button disabled={token==""} className="w-32 mt-4"
onClick={async () => {
Expand Down
3 changes: 2 additions & 1 deletion app/app/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { captchaVerify } from "@/lib/actions/captchaVerify";
const RegisterPage = () => {
const [loading, setLoading] = useState(true);
const [token,setToken] = useState<string>("")
const site_id = process.env.NEXT_PUBLIC_CAPTCHA_SITE_KEY || ""

const registerUser = async (formData: FormData) => {
const verify = await captchaVerify(token);
Expand Down Expand Up @@ -104,7 +105,7 @@ const RegisterPage = () => {
<div className="flex flex-col items-center w-full">
<Turnstile onSuccess={(token) => {
setToken(token)
}} siteKey='0x4AAAAAAAbu8T-y1tAsroOZ' />
}} siteKey={site_id} />
<Button className="mt-4" disabled={token == ""}>Register</Button>
</div>
</CardFooter>
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/captchaVerify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { HTTP_STATUS } from "../constants";

export async function captchaVerify (token:string) {
const SECRET_KEY = "0x4AAAAAAAbu8XnHHmSbg9kLI3T3HziPSuI"
const SECRET_KEY = process.env.CAPTCHA_SECRET_KEY || "";

let formData = new FormData();
formData.append('secret', SECRET_KEY);
Expand Down

0 comments on commit 5a4926d

Please sign in to comment.