import React, { useEffect, useState } from "react"; import Head from "next/head"; import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/router"; import { faWarning } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import Button from "~/components/basic/buttons/Button"; import Error from "~/components/basic/Error"; import InputField from "~/components/basic/InputField"; import attemptLogin from "~/utilities/attemptLogin"; import getWorkspaces from "./api/workspace/getWorkspaces"; export default function Login() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [errorLogin, setErrorLogin] = useState(false); const [isLoading, setIsLoading] = useState(false); const router = useRouter(); useEffect(async () => { let userWorkspace; try { const userWorkspaces = await getWorkspaces(); userWorkspace = userWorkspaces[0]._id; router.push("/dashboard/" + userWorkspace); } catch (error) { console.log("Error - Not logged in yet"); } }, []); /** * This function check if the user entered the correct credentials and should be allowed to log in. */ const loginCheck = async () => { setIsLoading(true); await attemptLogin( email, password, setErrorLogin, router, false, true ).then(() => { setTimeout(function () { setIsLoading(false); }, 2000); }); }; return (
Login
long logo

Log In

Need an Infisical account?

{errorLogin && }
{/*

I may have forgotten my password.

*/}
{false && (
We are experiencing minor technical difficulties. We are working on solving it right now. Please come back in a few minutes.
)}
); }