mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
secure strings for 2fa recovery codes
This commit is contained in:
parent
14745fa6ce
commit
71f755dd44
@ -436,7 +436,7 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(user.TwoFactorRecoveryCode))
|
if(string.IsNullOrWhiteSpace(user.TwoFactorRecoveryCode))
|
||||||
{
|
{
|
||||||
user.TwoFactorRecoveryCode = Guid.NewGuid().ToString("N");
|
user.TwoFactorRecoveryCode = Utilities.CoreHelpers.SecureRandomString(32, upper: false, special: false);
|
||||||
}
|
}
|
||||||
await SaveUserAsync(user);
|
await SaveUserAsync(user);
|
||||||
}
|
}
|
||||||
@ -474,7 +474,7 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
user.TwoFactorProviders = null;
|
user.TwoFactorProviders = null;
|
||||||
user.TwoFactorRecoveryCode = Guid.NewGuid().ToString("N");
|
user.TwoFactorRecoveryCode = Utilities.CoreHelpers.SecureRandomString(32, upper: false, special: false);
|
||||||
await SaveUserAsync(user);
|
await SaveUserAsync(user);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user