resolveAccountKindByUsername (verification/utils.ts)

FastGPT · packages/global/support/user/account/verification/utils.ts · typescript · Apache-2.0
auth

Module exposing: resolveAccountKindByUsername, resolveAccountVerificationByUsername

// Source: https://github.com/labring/FastGPT | License: Apache-2.0 | Copyright 2023 Sealos
// Provided via justclaw.it.com; keep this notice with the code.
import {
  AccountEmailUsernameSchema,
  AccountPhoneUsernameSchema,
  type AccountKind,
  type AccountVerificationCapabilities,
  type AccountVerificationMethod,
  type AccountVerificationPasswordPolicy,
  type AccountVerificationResolution
} from './type';

/**
 * 根据持久化 username 和 SSO 配置状态识别账号类型。
 * 邮箱、手机号和已知第三方前缀优先于通用 SSO 连字符规则。
 */
export const resolveAccountKindByUsername = ({
  username,
  ssoConfigured
}: {
  username: string;
  ssoConfigured: boolean;
}): AccountKind => {
  const normalizedUsername = username.trim();
  if (!normalizedUsername) return 'invalid';

  const firstSeparatorIndex = normalizedUsername.indexOf('-');
  c

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key