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.
This commit is contained in:
Max Peintner
2025-10-21 15:44:31 +02:00
committed by GitHub
parent f04d873270
commit d10be4c09a

View File

@@ -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) {