Skip to content

Commit 17be3fb

Browse files
committed
Updates
1 parent e57702c commit 17be3fb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

aspnetcore/blazor/security/webassembly/standalone-with-identity/qrcodes-for-authenticator-apps.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,18 @@ If 2FA is enabled, buttons appear to disable 2FA and regenerate recovery codes.
829829
TwoFactorCode = Input.Code
830830
});
831831
Input.Code = string.Empty;
832+
833+
// When 2FA is first enabled, recovery codes are returned.
834+
// However, subsequently disabling and re-enabling 2FA
835+
// leaves the existing codes in place and doesn't generate
836+
// a new set of recovery codes. The following code ensures
837+
// that a new set of recovery codes is generated each
838+
// time 2FA is enabled.
839+
if (twoFactorResponse.RecoveryCodes is null ||
840+
twoFactorResponse.RecoveryCodes.Length == 0)
841+
{
842+
await GenerateNewCodes();
843+
}
832844
}
833845
834846
private sealed class InputModel

0 commit comments

Comments
 (0)