From d4fec7ebaf02076391b3d740c9a6de8ae5c802a6 Mon Sep 17 00:00:00 2001 From: Max Peintner Date: Tue, 21 Oct 2025 15:44:31 +0200 Subject: [PATCH] fix(login): send invite codes only for users with unverified email (#10943) # Which Problems Are Solved When a user with no authentication methods attempted to log in, the system always set `invite=true` in the verification flow, regardless of whether their email was already verified. This could cause errors when trying to send invite codes to already initialized users. # How the Problems Are Solved Added conditional logic to determine whether to send an invite code based on the user's email verification status: This prevents errors when attempting to send invite codes to users who have already verified their email and been initialized, while still properly handling new users who need invitation flows. (cherry picked from commit d10be4c09ad94b725da170e1284d59bfbf2c7f0e) --- apps/login/src/lib/server/loginname.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/login/src/lib/server/loginname.ts b/apps/login/src/lib/server/loginname.ts index 4bd0ef6df0b..c74a7143b08 100644 --- a/apps/login/src/lib/server/loginname.ts +++ b/apps/login/src/lib/server/loginname.ts @@ -267,7 +267,7 @@ export async function sendLoginname(command: SendLoginnameCommand) { const params = new URLSearchParams({ loginName: session.factors?.user?.loginName as string, send: "true", // set this to true to request a new code immediately - invite: "true", // humanUser?.email?.isVerified ? "false" : "true", // sendInviteEmailCode results in an error if user is already initialized + invite: humanUser?.email?.isVerified ? "false" : "true", // sendInviteEmailCode results in an error if user is already initialized }); if (command.requestId) {