Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: only verify sso emails if the provider reports them unverified

Scott Wilson0ac023ea7003
diff --git a/backend/e2e-test/routes/v3/auth-signup-oauth.spec.ts b/backend/e2e-test/routes/v3/auth-signup-oauth.spec.ts
new file mode 100644
index 0000000000..bcea5fb409
--- /dev/null
+++ b/backend/e2e-test/routes/v3/auth-signup-oauth.spec.ts
@@ -0,0 +1,150 @@
+import crypto from "node:crypto";
+
+import { decode } from "jsonwebtoken";
+import { Knex } from "knex";
+
+import { TableName } from "@app/db/schemas";
+import { seedData1 } from "@app/db/seed-data";
+import { AuthMethod, AuthTokenType, ProviderAuthResult } from "@app/services/auth/auth-type";
+
+import { TTestSmtpService } from "../../mocks/smtp";
+
+const getDb = () => (globalThis as unknown as { testDb: Knex }).testDb;
+const smtp = () => (globalThis as unknown as { testSmtp: TTestSmtpService }).testSmtp;
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+const getServices = () => (globalThis as any).testServices;
+
+const findEmailTo = (recipient: string) =>
+ smtp()
+ .getEmails()
+ .find((e) => e.recipients?.includes(recipient));
+
+// Drives the OAuth login the way each passport strategy does, varying only the provider's
+// email-verification signal. authMethod defaults to Google; pass GITHUB/GITLAB to assert the
+// per-provider flag is set.
+const oauthLogin = (opts: { email: string; isEmailVerifiedByProvider: boolean; authMethod?: AuthMethod }) =>
+ getServices().login.oauth2Login({
+ email: opts.email,
+ firstName: "OAuth",
+ lastName: "Test",
+ authMethod: opts.authMethod ?? AuthMethod.GOOGLE,
+ providerUserId: `oauth-${crypto.randomUUID()}`,
+ isEmailVerifiedByProvider: opts.isEmailVerifiedByProvider,
+ ip: "127.0.0.1",
+ userAgent: "test-agent"
+ });
+
+const completeAccount = (signupToken: string, code: string) =>
+ testServer.inject({
+ method: "POST",
+ url: "/api/v3/signup/complete-account",
+ headers: { authorization: `Bearer ${signupToken}` },
+ body: { type: "alias", code }
+ });
+
+describe("Auth OAuth Signup V3 (provider-attested email verification)", () => {
+ const createdUserIds: string[] = [];
+
+ afterAll(async () => {
+ const db = getDb();
+ if (createdUserIds.length > 0) {
+ await db(TableName.UserAliases).whereIn("userId", createdUserIds).del();
+ await db(TableName.Membership).whereIn("actorUserId", createdUserIds).del();
+ await db(TableName.Users).whereIn("id", createdUserIds).where("id", "!=", seedData1.id).del();
+ }
+ });
+
+ beforeEach(() => {
+ smtp().clear();
+ });
+
+ describe("provider did NOT verify the email -> our verification is still required", () => {
+ test("new user gets SIGNUP_REQUIRED, an unverified token, and a verification email", async () => {
+ const email = `oauth-unverified-${crypto.randomUUID()}@localhost.local`;
+
+ const result = await oauthLogin({ email, isEmailVerifiedByProvider: false });
+
+ expect(result.result).toBe(ProviderAuthResult.SIGNUP_REQUIRED);
+ expect(result.signupToken).toBeDefined();
+ createdUserIds.push(result.user.id);
+
+ const decoded = decode(result.signupToken) as Record<string, unknown>;
+ expect(decoded.authTokenType).toBe(AuthTokenType.SIGNUP_TOKEN);
+ expect(decoded.isEmailVerified).toBe(false);
+
+ // a verification code email must have been sent
+ const verificationEmail = findEmailTo(email);
+ expect(verificationEmail).toBeDefined();
+ expect((verificationEmail?.substitutions as Record<string, string>)?.code).toBeDefined();
+
+ // and the user is persisted as unverified
+ const user = await getDb()(TableName.Users).where({ id: result.user.id }).first();
+ expect(user?.isEmailVerified).toBe(false);
+ expect(user?.isGoogleVerified ?? false).toBe(false);
+ });
+
+ test("completion rejects a wrong code and accepts the emailed code", async () => {
+ const email = `oauth-code-${crypto.randomUUID()}@localhost.local`;
+ const result = await oauthLogin({ email, isEmailVerifiedByProvider: false });
+ createdUserIds.push(result.user.id);
+
+ const code = (findEmailTo(email)?.substitutions as Record<string, string>)?.code;
+ expect(code).toBeDefined();
+
+ const wrong = await completeAccount(result.signupToken, "000000");
+ expect(wrong.statusCode).toBeGreaterThanOrEqual(400);
+
+ const ok = await completeAccount(result.signupToken, code);
+ expect(ok.statusCode).toBe(200);
+
+ const user = await getDb()(TableName.Users).where({ id: result.user.id }).first();
+ expect(user?.isEmailVerified).toBe(true);
+ expect(user?.isAccepted).toBe(true);
+ });
+ });
+
+ describe("provider verified the email -> our verification is skipped", () => {
+ test("new user gets a verified token, no verification email, and a verified user record", async () => {
+ const email = `oauth-verified-${crypto.randomUUID()}@localhost.local`;
+
+ const result = await oauthLogin({ email, isEmailVerifiedByProvider: true });
+
+ expect(result.result).toBe(ProviderAuthResult.SIGNUP_REQUIRED);
+ createdUserIds.push(result.user.id);
+
+ const decoded = decode(result.signupToken) as Record<string, unknown>;
+ expect(decoded.isEmailVerified).toBe(true);
+
+ // no verification email should have been sent
+ expect(findEmailTo(email)).toBeUndefined();
+
+ const user = await getDb()(TableName.Users).where({ id: result.user.id }).first();
+ expect(user?.isEmailVerified).toBe(true);
+ expect(user?.isGoogleVerified).toBe(true);
+ });
+
+ test("completion succeeds with no code (validation skipped) and accepts the account", async () => {
+ const email = `oauth-verified-complete-${crypto.randomUUID()}@localhost.local`;
+ const result = await oauthLogin({ email, isEmailVerifiedByProvider: true });
+ createdUserIds.push(result.user.id);
+
+ const res = await completeAccount(result.signupToken, "");
+ expect(res.statusCode).toBe(200);
+ expect(res.json()).toHaveProperty("token");
+
+ const user = await getDb()(TableName.Users).where({ id: result.user.id }).first();
+ expect(user?.isAccepted).toBe(true);
+ expect(user?.isEmailVerified).toBe(true);
+ });
+
+ test("GitHub sets the GitHub-specific verified flag", async () => {
+ const email = `oauth-github-${crypto.randomUUID()}@localhost.local`;
+ const result = await oauthLogin({ email, isEmailVerifiedByProvider: true, authMethod: AuthMethod.GITHUB });
+ createdUserIds.push(result.user.id);
+
+ expect(findEmailTo(email)).toBeUndefined();
+ const user = await getDb()(TableName.Users).where({ id: result.user.id }).first();
+ expect(user?.isGitHubVerified).toBe(true);
+ });
+ });
+});
diff --git a/backend/src/lib/requests/github.test.ts b/backend/src/lib/requests/github.test.ts
new file mode 100644
index 0000000000..52641807ff
--- /dev/null
+++ b/backend/src/lib/requests/github.test.ts
@@ -0,0 +1,41 @@
+import { selectGithubLoginEmail, TGithubEmail } from "./github";
+
+const email = (overrides: Partial<TGithubEmail> & Pick<TGithubEmail, "email">): TGithubEmail => ({
+ primary: false,
+ verified: false,
+ visibility: null,
+ ...overrides
+});
+
+describe("selectGithubLoginEmail", () => {
+ test("prefers the primary verified email", () => {
+ const result = selectGithubLoginEmail([
+ email({ email: "[email protected]", verified: true }),
+ email({ email: "[email protected]", primary: true, verified: true })
+ ]);
+
+ expect(result).toEqual({ email: "[email protected]", isEmailVerifiedByProvider: true });
+ });
+
+ test("falls back to any verified email when the primary email is unverified", () => {
+ const result = selectGithubLoginEmail([
+ email({ email: "[email protected]", primary: true, verified: false }),
+ email({ email: "[email protected]", verified: true })
+ ]);
+
+ expect(result).toEqual({ email: "[email protected]", isEmailVerifiedByProvider: true });
+ });
+
+ test("falls back to the primary email and reports it unverified when no email is verified", () => {
+ const result = selectGithubLoginEmail([
+ email({ email: "[email protected]", primary: true, verified: false }),
+ email({ email: "[email protected]", verified: false })
+ ]);
+
+ expect(result).toEqual({ email: "[email protected]", isEmailVerifiedByProvider: false });
+ });
+
+ test("returns null when the account exposes no emails", () => {
+ expect(selectGithubLoginEmail([])).toBeNull();
+ });
+});
diff --git a/backend/src/lib/requests/github.ts b/backend/src/lib/requests/github.ts
index 61e609eaf3..ddf33ef3d6 100644
--- a/backend/src/lib/requests/github.ts
+++ b/backend/src/lib/requests/github.ts
@@ -1,13 +1,34 @@
import { request } from "../config/request";
const INTEGRATION_GITHUB_API_URL = "https://api.github.com";
-type TGithubEmail = {
+export type TGithubEmail = {
email: string;
primary: boolean;
verified: boolean;
visibility: null | string;
};
+/**
+ * Choose the email to log a GitHub user in with. A GitHub account can hold multiple emails and not
+ * all of them are verified, so prefer the primary verified email, then any verified email, then the
+ * primary email. Returns null when the account exposes no usable email. The returned
+ * isEmailVerifiedByProvider reflects whether GitHub reports the chosen email as verified — only then
+ * can we skip our own email verification.
+ */
+export const selectGithubLoginEmail = (emails: TGithubEmail[]) => {
+ const chosen =
+ emails.find((githubEmail) => githubEmail.primary && githubEmail.verified) ??
+ emails.find((githubEmail) => githubEmail.verified) ??
+ emails.find((githubEmail) => githubEmail.primary);
+
+ if (!chosen?.email) return null;
+
+ // GitHub returns verified as a real JSON boolean; compare strictly so a stray non-boolean value
+ // can never be coerced into a false positive. Anything other than boolean true falls back to
+ // requiring our own verification (the safe direction).
+ return { email: chosen.email, isEmailVerifiedByProvider: chosen.verified === true };
+};
+
export const fetchGithubEmails = async (accessToken: string) => {
const { data } = await request.get<TGithubEmail[]>(`${INTEGRATION_GITHUB_API_URL}/user/emails`, {
headers: {
diff --git a/backend/src/server/routes/v1/sso-router.ts b/backend/src/server/routes/v1/sso-router.ts
index 68d574ad2a..6bcebf9c60 100644
--- a/backend/src/server/routes/v1/sso-router.ts
+++ b/backend/src/server/routes/v1/sso-router.ts
@@ -22,7 +22,7 @@ import { BadRequestError, NotFoundError } from "@app/lib/errors";
import { logger } from "@app/lib/logger";
import { ms } from "@app/lib/ms";
import { RequestContextKey } from "@app/lib/request-context/request-context-keys";
-import { fetchGithubEmails, fetchGithubUser } from "@app/lib/requests/github";
+import { fetchGithubEmails, fetchGithubUser, selectGithubLoginEmail } from "@app/lib/requests/github";
import {
AuthAttemptAuthMethod,
AuthAttemptAuthResult,
@@ -72,6 +72,11 @@ export const registerOauthMiddlewares = (server: FastifyZodProvider) => {
name: "OauthGoogleRegister"
});
+ // Google maps its email_verified claim onto emails[0].verified (a string "true"/"false"
+ // per the userinfo response, occasionally a boolean); when verified we skip our own
+ // email verification.
+ const isEmailVerifiedByProvider = String(profile?.emails?.[0]?.verified) === "true";
+
try {
const loginResult = await server.services.login.oauth2Login({
email,
@@ -81,6 +86,7 @@ export const registerOauthMiddlewares = (server: FastifyZodProvider) => {
callbackPort,
orgSlug,
providerUserId: profile.id,
+ isEmailVerifiedByProvider,
ip: requestContext.get("ip") || "",
userAgent: requestContext.get("userAgent") || ""
});
@@ -166,9 +172,9 @@ export const registerOauthMiddlewares = (server: FastifyZodProvider) => {
async (req: any, accessToken: string, _refreshToken: string, _profile: any, done: Function) => {
const authMetricStartTime = performance.now();
const ghEmails = await fetchGithubEmails(accessToken);
- const { email } = ghEmails.filter((gitHubEmail) => gitHubEmail.primary && gitHubEmail.verified)[0];
-
- if (!email) throw new Error("No primary email found");
+ const selectedEmail = selectGithubLoginEmail(ghEmails);
+ if (!selectedEmail) throw new Error("No email found for GitHub account");
+ const { email, isEmailVerifiedByProvider } = selectedEmail;
try {
// profile does not get automatically populated so we need to manually fetch user info
@@ -183,6 +189,7 @@ export const registerOauthMiddlewares = (server: FastifyZodProvider) => {
authMethod: AuthMethod.GITHUB,
callbackPort,
providerUserId: String(githubUser.id),
+ isEmailVerifiedByProvider,
ip: requestContext.get("ip") || "",
userAgent: requestContext.get("userAgent") || ""
});
@@ -266,6 +273,12 @@ export const registerOauthMiddlewares = (server: FastifyZodProvider) => {
async (req: any, _accessToken: string, _refreshToken: string, profile: any, cb: any) => {
const authMetricStartTime = performance.now();
const email = profile.emails[0].value;
+ // GitLab's /user API exposes confirmed_at as a non-empty ISO timestamp when the email is
+ // confirmed, or null otherwise (it is not a boolean). Treat a present, non-empty string as
+ // verified rather than coercing with Boolean(), so no non-string truthy value can slip in.
+ // eslint-disable-next-line no-underscore-dangle
+ const confirmedAt = profile?._json?.confirmed_at as unknown;
+ const isEmailVerifiedByProvider = typeof confirmedAt === "string" && confirmedAt.length > 0;
try {
const callbackPort = req.session.get("callbackPort");
@@ -277,6 +290,7 @@ export const registerOauthMiddlewares = (server: FastifyZodProvider) => {
authMethod: AuthMethod.GITLAB,
callbackPort,
providerUserId: String(profile.id),
+ isEmailVerifiedByProvider,
ip: requestContext.get("ip") || "",
userAgent: requestContext.get("userAgent") || ""
});
diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.ts
index 14bcd07e96..81493aaf80 100644
--- a/backend/src/services/auth/auth-login-service.ts
+++ b/backend/src/services/auth/auth-login-service.ts
@@ -838,6 +838,7 @@ export const authLoginServiceFactory = ({
callbackPort,
orgSlug,
providerUserId,
+ isEmailVerifiedByProvider,
ip,
userAgent
}: TOauthLoginDTO) => {
@@ -932,8 +933,12 @@ export const authLoginServiceFactory = ({
{
username: sanitizedEmail,
email: sanitizedEmail,
- isEmailVerified: false,
+ // when the provider already verified the email we skip our own verification step
+ isEmailVerified: isEmailVerifiedByProvider,
isAccepted: false,
+ ...(authMethod === AuthMethod.GOOGLE && { isGoogleVerified: isEmailVerifiedByProvider }),
+ ...(authMethod === AuthMethod.GITHUB && { isGitHubVerified: isEmailVerifiedByProvider }),
+ ...(authMethod === AuthMethod.GITLAB && { isGitLabVerified: isEmailVerifiedByProvider }),
firstName,
lastName,
authMethods: [authMethod],
@@ -990,7 +995,7 @@ export const authLoginServiceFactory = ({
externalId: providerUserId,
emails: [sanitizedEmail],
orgId: orgId || null,
- isEmailVerified: false
+ isEmailVerified: isEmailVerifiedByProvider
},
tx
);
@@ -1005,7 +1010,11 @@ export const authLoginServiceFactory = ({
user = await userDAL.updateById(user.id, {
authMethods: [...(user.authMethods || []), authMethod],
firstName,
- lastName
+ lastName,
+ // trust the provider's verification of the email when linking a new SSO method
+ ...(authMethod === AuthMethod.GOOGLE && { isGoogleVerified: isEmailVerifiedByProvider }),
+ ...(authMethod === AuthMethod.GITHUB && { isGitHubVerified: isEmailVerifiedByProvider }),
+ ...(authMethod === AuthMethod.GITLAB && { isGitLabVerified: isEmailVerifiedByProvider })
});
}
@@ -1025,10 +1034,11 @@ export const authLoginServiceFactory = ({
{
username: sanitizedEmail,
email: sanitizedEmail,
- // reverify email verification status on login
- isGitHubVerified: authMethod !== AuthMethod.GITHUB && user?.isGitHubVerified,
- isGoogleVerified: authMethod !== AuthMethod.GOOGLE && user?.isGoogleVerified,
- isGitLabVerified: authMethod !== AuthMethod.GITLAB && user?.isGitLabVerified
+ // the email changed at the provider: trust the provider's verification of the new
+ // email for the current method, and preserve the other providers' statuses
+ isGitHubVerified: authMethod === AuthMethod.GITHUB ? isEmailVerifiedByProvider : user?.isGitHubVerified,
+ isGoogleVerified: authMethod === AuthMethod.GOOGLE ? isEmailVerifiedByProvider : user?.isGoogleVerified,
+ isGitLabVerified: authMethod === AuthMethod.GITLAB ? isEmailVerifiedByProvider : user?.isGitLabVerified
},
tx
);
@@ -1036,7 +1046,8 @@ export const authLoginServiceFactory = ({
await userAliasDAL.updateById(
existingAlias.id,
{
- emails: [sanitizedEmail]
+ emails: [sanitizedEmail],
+ isEmailVerified: isEmailVerifiedByProvider
},
tx
);
@@ -1065,14 +1076,15 @@ export const authLoginServiceFactory = ({
}
}
- // Use user-level provider verification flags
+ // Skip our own email verification when the provider already verified the email, or when the
+ // user previously verified it through this provider (persisted user-level flag).
let isAliasVerified = false;
if (authMethod === AuthMethod.GOOGLE) {
- isAliasVerified = Boolean(user.isGoogleVerified);
+ isAliasVerified = isEmailVerifiedByProvider || Boolean(user.isGoogleVerified);
} else if (authMethod === AuthMethod.GITHUB) {
- isAliasVerified = Boolean(user.isGitHubVerified);
+ isAliasVerified = isEmailVerifiedByProvider || Boolean(user.isGitHubVerified);
} else if (authMethod === AuthMethod.GITLAB) {
- isAliasVerified = Boolean(user.isGitLabVerified);
+ isAliasVerified = isEmailVerifiedByProvider || Boolean(user.isGitLabVerified);
}
// Self-healing backfill: create alias for existing users found by email fallback
let aliasId = existingAlias?.id;
diff --git a/backend/src/services/auth/auth-login-type.ts b/backend/src/services/auth/auth-login-type.ts
index 18a58a1c8c..7cae51b4d5 100644
--- a/backend/src/services/auth/auth-login-type.ts
+++ b/backend/src/services/auth/auth-login-type.ts
@@ -36,6 +36,9 @@ export type TOauthLoginDTO = {
callbackPort?: number;
orgSlug?: string;
providerUserId: string;
+ // whether the OAuth provider itself guarantees the email is verified (Google email_verified,
+ // GitHub verified email, GitLab confirmed_at) — when true we skip our own email verification
+ isEmailVerifiedByProvider: boolean;
ip: string;
userAgent: string;
};
diff --git a/backend/src/services/auth/auth-signup-service.ts b/backend/src/services/auth/auth-signup-service.ts
index c243ac4b96..de16ca81b0 100644
--- a/backend/src/services/auth/auth-signup-service.ts
+++ b/backend/src/services/auth/auth-signup-service.ts
@@ -238,16 +238,21 @@ export const authSignupServiceFactory = ({
// Determine rejection before token validation, but don't throw yet
const shouldReject = !user || !decodedToken.aliasId || !userAlias;
- // Always validate the verification code so the bcrypt cost is incurred
- // Use dummy userId when rejecting so the work is still performed
- try {
- await tokenService.validateTokenForUser({
- type: TokenType.TOKEN_EMAIL_VERIFICATION,
- userId: shouldReject ? DUMMY_USER_ID : user.id,
- code: dto.code
- });
- } catch {
- throw new BadRequestError({ message: "Invalid token" });
+ // When the OAuth provider already verified the email, the signed signup token carries
+ // isEmailVerified=true and no verification code was ever issued, so skip code validation.
+ // The signed token itself is the proof of the provider's verification.
+ if (!decodedToken.isEmailVerified) {
+ // Always validate the verification code so the bcrypt cost is incurred
+ // Use dummy userId when rejecting so the work is still performed
+ try {
+ await tokenService.validateTokenForUser({
+ type: TokenType.TOKEN_EMAIL_VERIFICATION,
+ userId: shouldReject ? DUMMY_USER_ID : user.id,
+ code: dto.code
+ });
+ } catch {
+ throw new BadRequestError({ message: "Invalid token" });
+ }
}
if (shouldReject) {
diff --git a/frontend/src/pages/auth/SignUpSsoPage/SignUpSsoPage.tsx b/frontend/src/pages/auth/SignUpSsoPage/SignUpSsoPage.tsx
index c4282e176f..2010f2eece 100644
--- a/frontend/src/pages/auth/SignUpSsoPage/SignUpSsoPage.tsx
+++ b/frontend/src/pages/auth/SignUpSsoPage/SignUpSsoPage.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
import ReactCodeInput from "react-code-input";
import { Helmet } from "react-helmet";
import { useTranslation } from "react-i18next";
@@ -79,10 +79,10 @@ export const SignupSsoPage = () => {
SecurityClient.setSignupToken(token);
}, [token]);
- const handleSubmit = async () => {
+ const completeSignup = async (verificationCode: string) => {
const { token: accessToken } = await completeAccountSignup.mutateAsync({
type: "alias",
- code,
+ code: verificationCode,
hubspotUtk: getHubSpotUtk()
});
@@ -109,6 +109,25 @@ export const SignupSsoPage = () => {
}
};
+ const handleSubmit = async () => {
+ await completeSignup(code);
+ };
+
+ // When the OAuth provider already verified the email, no code is issued — finish signup automatically.
+ const hasAutoCompleted = useRef(false);
+ useEffect(() => {
+ if (decoded.isEmailVerified && !hasAutoCompleted.current) {
+ hasAutoCompleted.current = true;
+ completeSignup("").catch(() => {
+ createNotification({
+ text: "Failed to complete sign-up. Please try again.",
+ type: "error"
+ });
+ });
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [decoded.isEmailVerified]);
+
const handleResendCode = async () => {
try {
await sendEmailVerificationCode(token);
@@ -145,65 +164,76 @@ export const SignupSsoPage = () => {
<Card className="mx-auto w-full max-w-md items-stretch gap-0 p-6">
<CardHeader className="mb-2 gap-2">
<CardTitle className="bg-linear-to-b from-white to-bunker-200 bg-clip-text text-center text-[1.55rem] font-medium text-transparent">
- We&apos;ve sent a verification code to
+ {decoded.isEmailVerified
+ ? "Finishing your sign-up"
+ : "We've sent a verification code to"}
</CardTitle>
</CardHeader>
<CardContent>
<p className="text-md my-1 flex justify-center font-medium text-foreground">
{decoded.email}
</p>
- <div className="mx-auto hidden w-max min-w-[20rem] md:block">
- <ReactCodeInput
- name=""
- inputMode="tel"
- type="text"
- fields={6}
- onChange={setCode}
- {...codeInputStyle}
- className="code-input-v3 mt-6 mb-2"
- />
- </div>
- <div className="mx-auto mt-4 block w-max md:hidden">
- <ReactCodeInput
- name=""
- inputMode="tel"
- type="text"
- fields={6}
- onChange={setCode}
- {...codeInputStylePhone}
- className="code-input-v3 mt-2 mb-2"
- />
- </div>
- {completeAccountSignup.isError && (
- <FieldError>Oops. Your code is wrong. Please try again.</FieldError>
+ {decoded.isEmailVerified ? (
+ <p className="mt-4 flex justify-center text-center text-sm text-label">
+ Your email is already verified. Just a moment while we finish setting up your
+ account…
+ </p>
+ ) : (
+ <>
+ <div className="mx-auto hidden w-max min-w-[20rem] md:block">
+ <ReactCodeInput
+ name=""
+ inputMode="tel"
+ type="text"
+ fields={6}
+ onChange={setCode}
+ {...codeInputStyle}
+ className="code-input-v3 mt-6 mb-2"
+ />
+ </div>
+ <div className="mx-auto mt-4 block w-max md:hidden">
+ <ReactCodeInput
+ name=""
+ inputMode="tel"
+ type="text"
+ fields={6}
+ onChange={setCode}
+ {...codeInputStylePhone}
+ className="code-input-v3 mt-2 mb-2"
+ />
+ </div>
+ {completeAccountSignup.isError && (
+ <FieldError>Oops. Your code is wrong. Please try again.</FieldError>
+ )}
+ <div className="mt-4 w-full">
+ <Button
+ type="submit"
+ onClick={handleSubmit}
+ variant="project"
+ size="lg"
+ isFullWidth
+ isPending={completeAccountSignup.isPending}
+ isDisabled={completeAccountSignup.isPending}
+ >
+ Verify
+ </Button>
+ </div>
+ <div className="mt-6 flex flex-col items-center gap-2 text-xs text-label">
+ <div className="flex flex-row items-baseline gap-1">
+ <button
+ disabled={completeAccountSignup.isPending}
+ onClick={handleResendCode}
+ type="button"
+ >
+ <span className="cursor-pointer duration-200 hover:text-foreground hover:underline hover:decoration-project/45 hover:underline-offset-2">
+ Don&apos;t see the code? Resend
+ </span>
+ </button>
+ </div>
+ <p className="text-label">Make sure to check your spam inbox.</p>
+ </div>
+ </>
)}
- <div className="mt-4 w-full">
- <Button
- type="submit"
- onClick={handleSubmit}
- variant="project"
- size="lg"
- isFullWidth
- isPending={completeAccountSignup.isPending}
- isDisabled={completeAccountSignup.isPending}
- >
- Verify
- </Button>
- </div>
- <div className="mt-6 flex flex-col items-center gap-2 text-xs text-label">
- <div className="flex flex-row items-baseline gap-1">
- <button
- disabled={completeAccountSignup.isPending}
- onClick={handleResendCode}
- type="button"
- >
- <span className="cursor-pointer duration-200 hover:text-foreground hover:underline hover:decoration-project/45 hover:underline-offset-2">
- Don&apos;t see the code? Resend
- </span>
- </button>
- </div>
- <p className="text-label">Make sure to check your spam inbox.</p>
- </div>
</CardContent>
</Card>
</div>