diff options
| author | Claus Vium <cvium@users.noreply.github.com> | 2021-10-09 08:11:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-09 08:11:22 +0200 |
| commit | 1bfe6342df2fe7c094a31737bba511f9dfd44d71 (patch) | |
| tree | 14e65edf953efc1585dbfe859d513484a8793f3c /Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs | |
| parent | b16e6621b3e5f64e8e575f40ce3040d12125f9b7 (diff) | |
| parent | 3b492d4af8c432cc11b11e946b72aaf97cf63c95 (diff) | |
Merge pull request #6676 from Bond-009/rng
Use static crypto rng
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs b/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs index 25ef01dce..5e84255f9 100644 --- a/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs +++ b/Jellyfin.Server.Implementations/Users/DefaultPasswordResetProvider.cs @@ -93,13 +93,9 @@ namespace Jellyfin.Server.Implementations.Users /// <inheritdoc /> public async Task<ForgotPasswordResult> StartForgotPasswordProcess(User user, bool isInNetwork) { - string pin; - using (var cryptoRandom = RandomNumberGenerator.Create()) - { - byte[] bytes = new byte[4]; - cryptoRandom.GetBytes(bytes); - pin = BitConverter.ToString(bytes); - } + byte[] bytes = new byte[4]; + RandomNumberGenerator.Fill(bytes); + string pin = BitConverter.ToString(bytes); DateTime expireTime = DateTime.UtcNow.AddMinutes(30); string filePath = _passwordResetFileBase + user.Id + ".json"; @@ -114,7 +110,6 @@ namespace Jellyfin.Server.Implementations.Users await using (FileStream fileStream = AsyncFile.OpenWrite(filePath)) { await JsonSerializer.SerializeAsync(fileStream, spr).ConfigureAwait(false); - await fileStream.FlushAsync().ConfigureAwait(false); } user.EasyPassword = pin; |
