isEmailChangeAllowed (auth/email.ts)

librechat · packages/api/src/auth/email.ts · typescript · MIT
auth, database

Implements email change logic and utilities for LibreChat authentication.

// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from 'zod';
import { timingSafeEqual } from 'node:crypto';
import { logger, hashToken, getRandomValues, isValidObjectIdString } from '@librechat/data-schemas';
import type { EmailChangeErrorCode, TCustomConfig } from 'librechat-data-provider';
import { getSafeErrorMetadata } from '../utils/errors';
import { isEmailDomainAllowed } from './domain';
import { isEnabled } from '../utils/common';

export type { EmailChangeErrorCode } from 'librechat-data-provider';

export const EMAIL_CHANGE_TOKEN_TYPE = 'email_change';
const PASSWORD_RESET_TOKEN_TYPE = 'password_reset';

export function isEmailChangeAllowed(
  value: string |

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

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

Get a free API key