Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

680 B
Raw Blame
import { passwordProblem, type PasswordProblem } from '@trek/shared'

const PROBLEM_KEYS: Record<PasswordProblem, string> = {
  tooShort: 'settings.passwordTooShort',
  repetitive: 'settings.passwordRepetitive',
  common: 'settings.passwordCommon',
  weak: 'settings.passwordWeak',
}

/**
 * The translation key for why a new password would be refused, or null when the
 * server will take it (#1200). It runs the server's own policy from @trek/shared,
 * so a form says so before the request instead of after it.
 */
export function passwordErrorKey(password: string): string | null {
  const problem = passwordProblem(password)
  return problem ? PROBLEM_KEYS[problem] : null
}