misc: addressed totp visibility issue

This commit is contained in:
Sheen Capadngan
2025-05-01 20:26:49 +08:00
parent fdbb930940
commit 8e2cfe2c03
2 changed files with 42 additions and 1 deletions

View File

@@ -31,6 +31,25 @@ const codeInputProps = {
}
} as const;
const codeInputPropsPhone = {
inputStyle: {
fontFamily: "monospace",
margin: "4px",
MozAppearance: "textfield",
width: "40px",
borderRadius: "5px",
fontSize: "24px",
height: "40px",
paddingLeft: "7",
backgroundColor: "#0d1117",
color: "white",
border: "1px solid #2d2f33",
textAlign: "center",
outlineColor: "#8ca542",
borderColor: "#2d2f33"
}
} as const;
type Props = {
successCallback: () => void | Promise<void>;
closeMfa?: () => void;
@@ -172,6 +191,24 @@ export const Mfa = ({ successCallback, closeMfa, hideLogo, email, method }: Prop
</div>
)}
</div>
<div className="mx-auto mt-4 block w-max md:hidden">
{method === MfaMethod.EMAIL && (
<ReactCodeInput
name=""
inputMode="tel"
type="text"
fields={6}
onChange={setMfaCode}
className="mb-2 mt-2"
{...codeInputPropsPhone}
/>
)}
{method === MfaMethod.TOTP && (
<div className="mb-4 mt-2">
<Input value={mfaCode} onChange={(e) => setMfaCode(e.target.value)} />
</div>
)}
</div>
{typeof triesLeft === "number" && (
<Error text={`Invalid code. You have ${triesLeft} attempt(s) remaining.`} />
)}

View File

@@ -97,7 +97,11 @@ export const Route = createFileRoute("/_restrict-login-signup")({
}
if (!data.organizationId) {
if (location.pathname.endsWith("select-organization")) return;
if (
location.pathname.endsWith("select-organization") ||
location.pathname.endsWith("verify-email")
)
return;
throw redirect({ to: "/login/select-organization" });
}
throw redirect({