From a6477f3a2b2f8327f916e90cd52c94d134847baf Mon Sep 17 00:00:00 2001 From: Tino Hager Date: Fri, 14 Jun 2024 14:51:07 +0200 Subject: [PATCH] ef data update fix --- src/Nager.Authentication/Nager.Authentication.csproj | 2 +- src/Nager.Authentication/Services/UserAccountService.cs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Nager.Authentication/Nager.Authentication.csproj b/src/Nager.Authentication/Nager.Authentication.csproj index 9e3e6a3..3642492 100644 --- a/src/Nager.Authentication/Nager.Authentication.csproj +++ b/src/Nager.Authentication/Nager.Authentication.csproj @@ -20,7 +20,7 @@ enable net8.0;net7.0;net6.0 - 2.0.1 + 2.0.2 diff --git a/src/Nager.Authentication/Services/UserAccountService.cs b/src/Nager.Authentication/Services/UserAccountService.cs index 02ab978..0b7d00c 100644 --- a/src/Nager.Authentication/Services/UserAccountService.cs +++ b/src/Nager.Authentication/Services/UserAccountService.cs @@ -160,9 +160,14 @@ public async Task DeactivateMfaAsync( }; } - if (!await this.CreateMfaSecretAsync(emailAddress, cancellationToken)) + if (userEntity.MfaSecret == null) { - return null; + if (!await this.CreateMfaSecretAsync(emailAddress, cancellationToken)) + { + return null; + } + + userEntity = await this._userRepository.GetAsync(o => o.EmailAddress.Equals(emailAddress), cancellationToken); } var twoFactorAuthenticator = new TwoFactorAuthenticator();