1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-15 23:40:48 -05:00

Change email OTP to 6 digits

This commit is contained in:
Todd Martin 2025-06-14 12:40:43 -04:00
parent 7dcd68bb2b
commit 366d1a699f
No known key found for this signature in database
GPG Key ID: 663E7AF5C839BC8F
2 changed files with 7 additions and 6 deletions

View File

@ -25,7 +25,7 @@ public class EmailTokenProvider : IUserTwoFactorTokenProvider<User>
}; };
} }
public int TokenLength { get; protected set; } = 8; public int TokenLength { get; protected set; } = 6;
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;

View File

@ -7,17 +7,18 @@ 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)
{ {