diff --git a/components/Modals/Login.tsx b/components/Modals/Login.tsx index 8699be6..5dc402c 100644 --- a/components/Modals/Login.tsx +++ b/components/Modals/Login.tsx @@ -18,6 +18,7 @@ export default function LoginModal() { const { loginWithPubkey, currentUser } = useCurrentUser(); const [isLoading, setIsLoading] = useState(false); const [showExtensionLogin, setShowExtensionLogin] = useState(true); + const [showPassphraseLogin, setShowPassphraseLogin] = useState(false); const [nsec, setNsec] = useState(""); const [passphrase, setPassphrase] = useState(""); const [encryptedNsec, setEncryptedNsec] = useState(""); @@ -61,6 +62,7 @@ export default function LoginModal() { }; if (encryptedNsec_) { setEncryptedNsec(encryptedNsec_); + setShowPassphraseLogin(true); } else if (shouldReconnect === "true") { getConnected(shouldReconnect); } @@ -91,7 +93,7 @@ export default function LoginModal() { modal?.hide(); } async function handleLoginPassphrase() { - if (!encryptedNsec || passphrase) return; + if (!encryptedNsec || !passphrase) return; setIsLoading(true); const decryptedNsec = decryptMessage(encryptedNsec, passphrase); @@ -136,13 +138,14 @@ export default function LoginModal() { Connect with extension )} - {!!encryptedNsec && ( + {showPassphraseLogin ? (