leaguemanager.services.account.password_reset¶
Module Contents¶
Classes¶
Handles password reset operations. |
|
Handles password reset operations asynchronously. |
Data¶
API¶
- leaguemanager.services.account.password_reset.__all__¶
[‘PasswordResetService’, ‘PasswordResetAsyncService’]
- leaguemanager.services.account.password_reset.settings¶
‘get_settings(…)’
- class leaguemanager.services.account.password_reset.PasswordResetService¶
Bases:
leaguemanager.services.base.SQLAlchemySyncRepositoryServiceHandles password reset operations.
- class Repo¶
Bases:
advanced_alchemy.repository.SQLAlchemySyncRepository[leaguemanager.models.PasswordResetToken]Password reset repository.
- model_type¶
None
- repository_type¶
None
- class leaguemanager.services.account.password_reset.PasswordResetAsyncService¶
Bases:
leaguemanager.services.base.SQLAlchemyAsyncRepositoryServiceHandles password reset operations asynchronously.
- class Repo¶
Bases:
advanced_alchemy.repository.SQLAlchemyAsyncRepository[leaguemanager.models.PasswordResetToken]Password reset repository.
- model_type¶
None
- repository_type¶
None
- match_fields¶
[‘token’]
- async create_reset_token(user_id: uuid.UUID, ip_address: str | None = None, user_agent: str | None = None) leaguemanager.models.PasswordResetToken¶
Create a new password reset token for a user.
Args: user_id: The user’s UUID ip_address: IP address of the request user_agent: User agent string of the request
Returns: The created PasswordResetToken instance
- async validate_reset_token(token: str) leaguemanager.models.PasswordResetToken | None¶
Validate a token without consuming it.
Args: token: The reset token string
Returns: The PasswordResetToken instance if valid, None otherwise
Raises: HTTPException: If token is invalid, expired, or already used
- async use_reset_token(token: str) leaguemanager.models.PasswordResetToken¶
Use a token to mark it as consumed.
Args: token: The reset token string
Returns: The PasswordResetToken instance
Raises: HTTPException: If token is invalid, expired, or already used
- async invalidate_user_tokens(user_id: uuid.UUID) None¶
Invalidate all active tokens for a user.
Args: user_id: The user’s UUID
- async cleanup_expired_tokens() int¶
Remove expired tokens from the database.
Returns: Number of tokens removed
- async check_rate_limit(user_id: uuid.UUID, hours: int = 1) bool¶
Check if user has exceeded reset token creation rate limit.
Args: user_id: The user’s UUID hours: Hours to look back for rate limiting
Returns: True if rate limit exceeded, False otherwise