synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
116 lines (115 loc) • 3.26 kB
JavaScript
import { jsxs as t, Fragment as n, jsx as o } from "react/jsx-runtime";
import { Link as c, Typography as O, Button as y, Alert as h } from "@mui/material";
import R from "./RecoveryCodeForm.js";
import C from "./TOTPForm.js";
const p = "Use a backup code instead", F = "Use authenticator app instead", k = "Lost access to your codes?", A = "Send Instructions", g = "Instructions to reset two-factor authentication were sent to the primary email address associated with your account.";
function P(m) {
const {
step: e,
loginIsPending: s,
onSubmit: a,
onClickUseBackupCode: u,
onClickUseTOTP: l,
hideReset2FA: _,
onClickPromptReset2FA: T,
onClickReset2FA: i,
twoFactorAuthResetIsSuccess: d,
twoFactorAuthResetIsPending: E
} = m;
return /* @__PURE__ */ t(n, { children: [
e === "VERIFICATION_CODE" && /* @__PURE__ */ t(n, { children: [
/* @__PURE__ */ o(
C,
{
loginIsPending: s,
onSubmit: (r) => {
a(r, "TOTP");
}
}
),
/* @__PURE__ */ o(
c,
{
align: "center",
color: "grey.700",
sx: { display: "block", mx: "auto", my: 2 },
onClick: () => {
u();
},
children: p
}
)
] }),
e === "RECOVERY_CODE" && /* @__PURE__ */ t(n, { children: [
/* @__PURE__ */ o(
R,
{
loginIsPending: s,
onSubmit: (r) => {
a(r, "RECOVERY_CODE");
}
}
),
/* @__PURE__ */ o(
c,
{
align: "center",
color: "grey.700",
sx: { display: "block", mx: "auto", my: 2 },
onClick: () => {
l();
},
children: F
}
)
] }),
!_ && T && i && e !== "DISABLE_2FA_PROMPT" && /* @__PURE__ */ o(
c,
{
align: "center",
color: "grey.700",
sx: { display: "block", mx: "auto", my: 2 },
onClick: () => {
T();
},
children: k
}
),
e === "DISABLE_2FA_PROMPT" && i && /* @__PURE__ */ t(n, { children: [
/* @__PURE__ */ o(O, { variant: "body1", align: "center", sx: { my: 2 }, children: "To reset two-factor authentication on your account, an email containing instructions will be sent to the primary email address on your account." }),
/* @__PURE__ */ o(
y,
{
fullWidth: !0,
variant: "contained",
onClick: i,
disabled: E || d,
sx: { my: 2 },
children: A
}
),
d && /* @__PURE__ */ o(h, { severity: "success", sx: { my: 1 }, children: g }),
/* @__PURE__ */ o(
c,
{
align: "center",
color: "grey.700",
sx: { display: "block", mx: "auto", my: 2 },
onClick: () => {
l();
},
children: "Go back"
}
)
] })
] });
}
export {
k as BEGIN_RESET_2FA_BUTTON_TEXT,
A as SEND_RESET_2FA_EMAIL_BUTTON_TEXT,
p as SHOW_RECOVERY_CODE_FORM_BUTTON_TEXT,
F as SHOW_TOTP_FORM_BUTTON_TEXT,
g as TWO_FACTOR_RESET_CONFIRMATION_TEXT,
P as default
};
//# sourceMappingURL=OneTimePasswordForm.js.map