Two-factor authentication is managed by your mail administrator.
- ) : ( -Loading…
; - - const begin = async () => { - try { - setSetup(await apiFetch<{ secret: string; url: string }>("/api/account/2fa/begin", { method: "POST", body: "{}" })); - setCode(""); setPassword(""); - } catch (err) { - toast.error((err as Error).message); - } - }; - - const enable = async () => { - if (!setup) return; - setBusy(true); - try { - const res = await apiFetch<{ sessionKept: boolean }>("/api/account/2fa/enable", { - method: "POST", - body: JSON.stringify({ url: setup.url, code, current: password }), - }); - setSetup(null); - await reload(); - if (res.sessionKept) { - toast.success("Two-factor authentication is on. This browser stays signed in."); - } else { - toast.success("Two-factor authentication is on. You'll need to sign in again with a code."); - } - } catch (err) { - toast.error((err as Error).message); - } finally { - setBusy(false); - } - }; - const disable = async () => { setBusy(true); try { @@ -225,51 +198,15 @@ function TwoFactor({ state, reload }: { state: SecurityState | null; reload: () return (- {state.otpEnabled - ? "Signing in requires a code from your authenticator app as well as your password." - : "Add a one-time code from an authenticator app to your sign-in, so a stolen password isn't enough on its own."} + This account has two-factor authentication on. ihasmail can't sign you in with a code yet, so signing in on another + device needs an app password — or you can turn two-factor authentication off here.