feat(auth): verify google signup mobile before account creation
Some checks failed
Frontend CI/CD / build (push) Has been cancelled
Frontend CI/CD / deploy (push) Has been cancelled

This commit is contained in:
2026-05-14 23:24:21 +03:30
parent cd5409c9b2
commit 2ab42c287f
2 changed files with 10 additions and 5 deletions

View File

@@ -127,7 +127,7 @@ export type GoogleOAuthFlowResponse =
mobile: string; mobile: string;
detail?: string; detail?: string;
email: string; email: string;
resolution: "existing_email_claim" | "existing_mobile_claim"; resolution: "new_account" | "existing_email_claim" | "existing_mobile_claim";
mobile_hint?: string | null; mobile_hint?: string | null;
}; };

View File

@@ -182,7 +182,7 @@ export default function GoogleAuthCallback() {
const payload = await completeGoogleOAuthSignup(flow, mobile); const payload = await completeGoogleOAuthSignup(flow, mobile);
applyFlowPayload(payload); applyFlowPayload(payload);
if (payload.status === "claim_required") { if (payload.status === "claim_required") {
toast.success(t.login.google.claimOtpSent); toast.success(payload.resolution === "new_account" ? t.login.toasts.verifySent : t.login.google.claimOtpSent);
} }
} catch (error) { } catch (error) {
const message = error instanceof Error ? error.message : t.login.google.completeFailed; const message = error instanceof Error ? error.message : t.login.google.completeFailed;
@@ -273,7 +273,8 @@ export default function GoogleAuthCallback() {
<h1 className="text-2xl font-semibold tracking-tight"> <h1 className="text-2xl font-semibold tracking-tight">
{step === "loading" && t.login.google.loadingTitle} {step === "loading" && t.login.google.loadingTitle}
{step === "collect_mobile" && t.login.google.collectMobileTitle} {step === "collect_mobile" && t.login.google.collectMobileTitle}
{step === "claim_required" && t.login.google.claimTitle} {step === "claim_required" &&
(flowResolution === "new_account" ? t.login.signupVerifyTitle : t.login.google.claimTitle)}
{step === "error" && t.login.google.errorTitle} {step === "error" && t.login.google.errorTitle}
</h1> </h1>
<p className="text-sm text-slate-500 dark:text-slate-400"> <p className="text-sm text-slate-500 dark:text-slate-400">
@@ -285,7 +286,9 @@ export default function GoogleAuthCallback() {
{step === "claim_required" && {step === "claim_required" &&
(flowResolution === "existing_email_claim" (flowResolution === "existing_email_claim"
? t.login.google.claimDescription(mobileHint || mobile) ? t.login.google.claimDescription(mobileHint || mobile)
: t.login.google.mobileClaimDescription(mobile))} : flowResolution === "existing_mobile_claim"
? t.login.google.mobileClaimDescription(mobile)
: t.login.sentCodeDesc(mobile))}
{step === "error" && (errorMessage || t.login.google.loadFailed)} {step === "error" && (errorMessage || t.login.google.loadFailed)}
</p> </p>
</div> </div>
@@ -372,7 +375,9 @@ export default function GoogleAuthCallback() {
<p className="mb-3 text-sm text-slate-500 dark:text-slate-400"> <p className="mb-3 text-sm text-slate-500 dark:text-slate-400">
{flowResolution === "existing_email_claim" {flowResolution === "existing_email_claim"
? t.login.google.claimDescription(mobileHint || mobile) ? t.login.google.claimDescription(mobileHint || mobile)
: t.login.google.mobileClaimDescription(mobile)} : flowResolution === "existing_mobile_claim"
? t.login.google.mobileClaimDescription(mobile)
: t.login.sentCodeDesc(mobile)}
</p> </p>
<Input <Input
id="google-claim-otp" id="google-claim-otp"