import { useState } from "react"; import { useTranslation } from "react-i18next"; import Link from "next/link"; import { useRouter } from "next/router" import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import attemptLogin from "@app/components/utilities/attemptLogin"; import { Button, Input } from "@app/components/v2"; import getOrganizations from "@app/pages/api/organization/getOrgs"; type Props = { providerAuthToken: string; email: string; password: string; setPassword: (password: string) => void; setStep: (step: number) => void; } export const PasswordStep = ({ providerAuthToken, email, password, setPassword, setStep }: Props) => { const { createNotification } = useNotificationContext(); const [isLoading, setIsLoading] = useState(false); const { t } = useTranslation(); const router = useRouter(); const handleLogin = async () => { try { setIsLoading(true); const loginAttempt = await attemptLogin({ email, password, providerAuthToken, }); if (loginAttempt && loginAttempt.success) { // case: login was successful if (loginAttempt.mfaEnabled) { // TODO: deal with MFA // case: login requires MFA step setIsLoading(false); setStep(2); return; } // case: login does not require MFA step const userOrgs = await getOrganizations(); const userOrg = userOrgs[0]._id; setIsLoading(false); createNotification({ text: "Successfully logged in", type: "success" }); router.push(`/org/${userOrg?._id}/overview`); } } catch (err) { setIsLoading(false); createNotification({ text: "Login unsuccessful. Double-check your master password and try again.", type: "error" }); console.error(err); } }; return (
e.preventDefault()} className="h-full mx-auto w-full max-w-md px-6 pt-8" >

What’s your Infisical Password?

setPassword(e.target.value)} type="password" placeholder="Enter your password..." isRequired autoComplete="current-password" id="current-password" className="h-12" />
Infisical Master Password serves as a decryption mechanism so that even Google is not able to access your secrets. {t("login.forgot-password")}
); }