1
0
mirror of https://github.com/bitwarden/server synced 2025-12-19 01:33:20 +00:00

chore(feature-flag): [PM-18179] Remove pm-17128-recovery-code-login feature flag

* Rmoved feature flag and obsolete endpoint

* Removed obsolete method.
This commit is contained in:
Todd Martin
2025-09-02 11:18:36 -04:00
committed by GitHub
parent 101e29b354
commit cb1db262ca
4 changed files with 0 additions and 52 deletions

View File

@@ -865,39 +865,6 @@ public class UserService : UserManager<User>, IUserService
}
}
/// <summary>
/// To be removed when the feature flag pm-17128-recovery-code-login is removed PM-18175.
/// </summary>
[Obsolete("Two Factor recovery is handled in the TwoFactorAuthenticationValidator.")]
public async Task<bool> RecoverTwoFactorAsync(string email, string secret, string recoveryCode)
{
var user = await _userRepository.GetByEmailAsync(email);
if (user == null)
{
// No user exists. Do we want to send an email telling them this in the future?
return false;
}
if (!await VerifySecretAsync(user, secret))
{
return false;
}
if (!CoreHelpers.FixedTimeEquals(user.TwoFactorRecoveryCode, recoveryCode))
{
return false;
}
user.TwoFactorProviders = null;
user.TwoFactorRecoveryCode = CoreHelpers.SecureRandomString(32, upper: false, special: false);
await SaveUserAsync(user);
await _mailService.SendRecoverTwoFactorEmail(user.Email, DateTime.UtcNow, _currentContext.IpAddress);
await _eventService.LogUserEventAsync(user.Id, EventType.User_Recovered2fa);
await CheckPoliciesOnTwoFactorRemovalAsync(user);
return true;
}
public async Task<bool> RecoverTwoFactorAsync(User user, string recoveryCode)
{
if (!CoreHelpers.FixedTimeEquals(