Interface IPasswordResetTokenRepository
Repository interface for managing password reset tokens
Namespace: OEMS.Core.Domain.RepoInterfaces
Assembly: OEMS.Core.dll
Syntax
public interface IPasswordResetTokenRepository
Methods
CreateAsync(PasswordResetToken)
Creates a new password reset token
Declaration
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
Task<int> DeleteExpiredTokensAsync()
Returns
Type | Description |
---|---|
Task<int> | Number of deleted tokens |
GetByTokenAsync(string)
Gets a password reset token by its token string
Declaration
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
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
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
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 |