mirror of
https://github.com/bitwarden/server.git
synced 2025-07-27 04:21:00 -05:00
feat(otp): Revert [PM-18612] Consolidate all email OTP to use 6 digits
This reverts commit 737f549f82
.
This commit is contained in:
@ -7,9 +7,6 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
|
|
||||||
namespace Bit.Core.Auth.Identity.TokenProviders;
|
namespace Bit.Core.Auth.Identity.TokenProviders;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Generates and validates tokens for email OTPs.
|
|
||||||
/// </summary>
|
|
||||||
public class EmailTokenProvider : IUserTwoFactorTokenProvider<User>
|
public class EmailTokenProvider : IUserTwoFactorTokenProvider<User>
|
||||||
{
|
{
|
||||||
private const string CacheKeyFormat = "EmailToken_{0}_{1}_{2}";
|
private const string CacheKeyFormat = "EmailToken_{0}_{1}_{2}";
|
||||||
@ -28,7 +25,7 @@ public class EmailTokenProvider : IUserTwoFactorTokenProvider<User>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public int TokenLength { get; protected set; } = 6;
|
public int TokenLength { get; protected set; } = 8;
|
||||||
public bool TokenAlpha { get; protected set; } = false;
|
public bool TokenAlpha { get; protected set; } = false;
|
||||||
public bool TokenNumeric { get; protected set; } = true;
|
public bool TokenNumeric { get; protected set; } = true;
|
||||||
|
|
||||||
|
@ -10,18 +10,17 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
|
|
||||||
namespace Bit.Core.Auth.Identity.TokenProviders;
|
namespace Bit.Core.Auth.Identity.TokenProviders;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Generates tokens for email two-factor authentication.
|
|
||||||
/// It inherits from the EmailTokenProvider class, which manages the persistence and validation of tokens,
|
|
||||||
/// and adds additional validation to ensure that 2FA is enabled for the user.
|
|
||||||
/// </summary>
|
|
||||||
public class EmailTwoFactorTokenProvider : EmailTokenProvider
|
public class EmailTwoFactorTokenProvider : EmailTokenProvider
|
||||||
{
|
{
|
||||||
public EmailTwoFactorTokenProvider(
|
public EmailTwoFactorTokenProvider(
|
||||||
[FromKeyedServices("persistent")]
|
[FromKeyedServices("persistent")]
|
||||||
IDistributedCache distributedCache) :
|
IDistributedCache distributedCache) :
|
||||||
base(distributedCache)
|
base(distributedCache)
|
||||||
{ }
|
{
|
||||||
|
TokenAlpha = false;
|
||||||
|
TokenNumeric = true;
|
||||||
|
TokenLength = 6;
|
||||||
|
}
|
||||||
|
|
||||||
public override Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<User> manager, User user)
|
public override Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<User> manager, User user)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user