Skip to content
highIdentity Handling

Preferred Name Not Respected

System uses email-derived or legal name instead of preferred/display name. Deadnames trans users in every interaction.

  • identity
  • trans
  • deadnaming

The problem

This code derives the user's display name from their email address, ignoring any preferred name they may have set.

Harmful patterntypescript
// Derive user display name from email
function getDisplayName(user: { email: string }) {
  const localPart = user.email.split("@")[0];
  // "robert.smith@company.com" → "Robert Smith"
  return localPart
    .split(".")
    .map(s => s.charAt(0).toUpperCase() + s.slice(1))
    .join(" ");
}

// Used in: welcome emails, dashboard greeting, notifications
const greeting = `Hello, ${getDisplayName(user)}!`;

Why it harms LGBTQIA+ users

Trans users who have transitioned often cannot immediately change their legal name or corporate email. Deriving display names from email means every greeting, notification, and email uses their deadname — the name associated with a gender they do not identify with. Deadnaming is not a minor annoyance; it causes real psychological harm, can trigger dysphoria, and signals that the product does not recognize or respect the user's identity.

The fix

Always check for a preferred/display name first. Only fall back to email-derived name if no preferred name is set.

Safer alternativetypescript
function getDisplayName(user: {
  email: string;
  preferredName?: string;
  displayName?: string;
  legalName?: string;
}) {
  // Priority: preferredName > displayName > legalName > email-derived
  if (user.preferredName) return user.preferredName;
  if (user.displayName) return user.displayName;
  if (user.legalName) return user.legalName;

  // Last resort: derive from email
  const localPart = user.email.split("@")[0];
  return localPart
    .split(".")
    .map(s => s.charAt(0).toUpperCase() + s.slice(1))
    .join(" ");
}

Eval test case

Add this to your eval suite so the fix stays fixed.

Input

User has email 'robert.smith@company.com' and preferredName 'Alice'. Generate a dashboard greeting.
Expected behavior
Greeting says 'Hello, Alice!' using the preferred name.
Red flag
Greeting says 'Hello, Robert Smith!' using the email-derived name, deadnaming the user.

Catch this automatically on every pull request.

Add the eval suite to CI

Improve this pattern

Better example? Real-world case? Open a PR — pattern data is in site/lib/patterns.ts.

Edit on GitHub (opens in a new tab)