1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 23:52:50 -05:00

[PM-7919] return exception if trying to overwrite keypair (#4052)

* return exception if trying to overwrite keypair

* add feature flag
This commit is contained in:
Jake Fink
2024-05-06 08:49:18 -04:00
committed by GitHub
parent 90e065556e
commit 2a535ac835
2 changed files with 10 additions and 0 deletions

View File

@ -618,6 +618,14 @@ public class AccountsController : Controller
throw new UnauthorizedAccessException();
}
if (_featureService.IsEnabled(FeatureFlagKeys.ReturnErrorOnExistingKeypair))
{
if (!string.IsNullOrWhiteSpace(user.PrivateKey) || !string.IsNullOrWhiteSpace(user.PublicKey))
{
throw new BadRequestException("User has existing keypair");
}
}
await _userService.SaveUserAsync(model.ToUser(user));
return new KeysResponseModel(user);
}