mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 00:22:50 -05:00
Parse enum as to accept 0 values or full string values
This commit is contained in:
@ -273,13 +273,13 @@ namespace Bit.Core.Services
|
||||
return IdentityResult.Failed(_identityErrorDescriber.PasswordMismatch());
|
||||
}
|
||||
|
||||
public async Task GetTwoFactorAsync(User user, Enums.TwoFactorProviderType provider)
|
||||
public async Task GetTwoFactorAsync(User user, TwoFactorProviderType provider)
|
||||
{
|
||||
if(user.TwoFactorEnabled && user.TwoFactorProvider.HasValue && user.TwoFactorProvider.Value == provider)
|
||||
{
|
||||
switch(provider)
|
||||
{
|
||||
case Enums.TwoFactorProviderType.Authenticator:
|
||||
case TwoFactorProviderType.Authenticator:
|
||||
if(!string.IsNullOrWhiteSpace(user.AuthenticatorKey))
|
||||
{
|
||||
return;
|
||||
@ -296,7 +296,7 @@ namespace Bit.Core.Services
|
||||
|
||||
switch(provider)
|
||||
{
|
||||
case Enums.TwoFactorProviderType.Authenticator:
|
||||
case TwoFactorProviderType.Authenticator:
|
||||
var key = KeyGeneration.GenerateRandomKey(20);
|
||||
user.AuthenticatorKey = Base32Encoding.ToString(key);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user