DEFAULT_PASSWORD_REQUIREMENTS

const
Form & Input

Default set of password strength rules used by OrigamPasswordField when `requirements: true` is passed without an explicit array. Each rule has an id, an English label, and a predicate function.

TypeScript

Definition

The TypeScript definition as found in the origam source. Click the copy icon to copy the snippet.

typescript

Entries

Values

All entries in this constant. Click a value to copy it to clipboard.

{ id: 'min-length', label: `At least ${PASSWORD_MIN_LENGTH} characters`, test: (v: string) => (v ?? '').length >= PASSWORD_MIN_LENGTH }
{ id: 'min-length', label: 'At least 8 characters', test: (v: string) => (v ?? '').length >= 8 }
{ id: 'uppercase', label: 'At least 1 uppercase letter', test: (v: string) => /[A-Z]/.test(v ?? '') }
{ id: 'uppercase', label: 'At least 1 uppercase letter', test: (v: string) => PASSWORD_PATTERN_UPPERCASE.test(v ?? '') }
{ id: 'number', label: 'At least 1 number', test: (v: string) => PASSWORD_PATTERN_DIGIT.test(v ?? '') }
{ id: 'number', label: 'At least 1 number', test: (v: string) => /\d/.test(v ?? '') }
{ id: 'special', label: 'At least 1 special character', test: (v: string) => PASSWORD_PATTERN_SPECIAL.test(v ?? '') }
{ id: 'special', label: 'At least 1 special character', test: (v: string) => /[^A-Za-z0-9]/.test(v ?? '') }

Ecosystem

Used by

Composables and components that consume this constant.

  • OrigamPasswordField

Usage

Examples

Ready-to-paste code snippets using this constant.

Using the default requirements

typescript