Skip to main content

checkPasswordChangeRateLimit

API Docs


Function: checkPasswordChangeRateLimit()

checkPasswordChangeRateLimit(cache, userId, logger, config?): Promise<void>

Defined in: src/utilities/passwordChangeRateLimit.ts:49

Checks if a user has exceeded the rate limit for password changes. Uses Redis via CacheService with a fixed time window.

Parameters

cache

RateLimitCache

The cache instance (Redis-backed)

userId

string

The user ID to check

logger

RateLimitLogger

Logger for violation logging

config?

PasswordChangeRateLimitConfig

Optional configurable limits

Returns

Promise<void>

Throws

TalawaGraphQLError with code "too_many_requests" and httpStatus 429