Form Validation Utilities (utils/form.ts)

logto · packages/experience/src/utils/form.ts · typescript · MPL-2.0
auth, ui, email, voice, tag:validation

Provides validation functions for email, phone, and identifier fields used in authentication forms. When to reuse: When building sign-up or sign-in forms needing input validation.

// Source: https://github.com/logto-io/logto | License: MPL-2.0 | Copyright under Patent Claims infringed by Covered Software in the absence of | Modified files must remain under MPL-2.0
// Modifications to this file must remain under MPL-2.0.
// Provided via justclaw.it.com; keep this notice with the code.
import { emailRegEx } from '@logto/core-kit';
import { SignInIdentifier, type UsernamePolicy } from '@logto/schemas';
import { PhoneNumberParser } from '@logto/shared/universal';
import i18next from 'i18next';
import type { TFuncKey } from 'i18next';
import { ParseError } from 'libphonenumber-js/mobile';

import type { ErrorType } from '@/shared/components/ErrorMessage';
import type { IdentifierInputType } from '@/shared/components/InputFields/SmartInputField';
import { validateUsername

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

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

Get a free API key