1
0
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:
Kyle Spearrin 2017-06-29 16:01:11 -04:00
parent 14745fa6ce
commit 71f755dd44

View File

@ -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;