Search Results for

    Show / Hide Table of Contents

    Class PasswordResetTokenRepository

    Repository implementation for password reset tokens

    Inheritance
    object
    PasswordResetTokenRepository
    Implements
    IPasswordResetTokenRepository
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: OEMS.Core.Infrastructure.Repositories
    Assembly: OEMS.Core.dll
    Syntax
    public class PasswordResetTokenRepository : IPasswordResetTokenRepository

    Constructors

    PasswordResetTokenRepository(IDbContextFactory<OEMSDBContext>, ILogger<PasswordResetTokenRepository>)

    Initializes a new instance of the PasswordResetTokenRepository class

    Declaration
    public PasswordResetTokenRepository(IDbContextFactory<OEMSDBContext> contextFactory, ILogger<PasswordResetTokenRepository> logger)
    Parameters
    Type Name Description
    IDbContextFactory<OEMSDBContext> contextFactory

    Database context factory

    ILogger<PasswordResetTokenRepository> logger

    Logger for the repository

    Methods

    CreateAsync(PasswordResetToken)

    Creates a new password reset token

    Declaration
    public Task<bool> CreateAsync(PasswordResetToken token)
    Parameters
    Type Name Description
    PasswordResetToken token

    The password reset token to create

    Returns
    Type Description
    Task<bool>

    True if creation was successful, false otherwise

    DeleteExpiredTokensAsync()

    Deletes expired password reset tokens (cleanup)

    Declaration
    public Task<int> DeleteExpiredTokensAsync()
    Returns
    Type Description
    Task<int>

    Number of deleted tokens

    GetByTokenAsync(string)

    Gets a password reset token by its token string

    Declaration
    public Task<PasswordResetToken?> GetByTokenAsync(string token)
    Parameters
    Type Name Description
    string token

    The token string

    Returns
    Type Description
    Task<PasswordResetToken>

    The password reset token if found, null otherwise

    GetValidTokensByUserIdAsync(Guid)

    Gets all valid (unused and not expired) password reset tokens for a user

    Declaration
    public Task<List<PasswordResetToken>> GetValidTokensByUserIdAsync(Guid userId)
    Parameters
    Type Name Description
    Guid userId

    The user ID

    Returns
    Type Description
    Task<List<PasswordResetToken>>

    List of valid password reset tokens

    InvalidateAllUserTokensAsync(Guid)

    Invalidates all password reset tokens for a user

    Declaration
    public Task<bool> InvalidateAllUserTokensAsync(Guid userId)
    Parameters
    Type Name Description
    Guid userId

    The user ID

    Returns
    Type Description
    Task<bool>

    True if invalidation was successful, false otherwise

    MarkAsUsedAsync(Guid)

    Marks a token as used

    Declaration
    public Task<bool> MarkAsUsedAsync(Guid tokenId)
    Parameters
    Type Name Description
    Guid tokenId

    The token ID

    Returns
    Type Description
    Task<bool>

    True if update was successful, false otherwise

    Implements

    IPasswordResetTokenRepository
    In this article
    Back to top Generated by DocFX