Greenfield: allow delete user by email too (#5372)

This commit is contained in:
Andrew Camilleri 2023-10-10 05:26:23 +02:00 committed by GitHub
parent 1d210eb6e3
commit f20e6d3768
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -216,12 +216,12 @@ namespace BTCPayServer.Controllers.Greenfield
return CreatedAtAction(string.Empty, model);
}
[HttpDelete("~/api/v1/users/{userId}")]
[HttpDelete("~/api/v1/users/{idOrEmail}")]
[Authorize(Policy = Policies.CanModifyServerSettings, AuthenticationSchemes = AuthenticationSchemes.Greenfield)]
public async Task<IActionResult> DeleteUser(string userId)
public async Task<IActionResult> DeleteUser(string idOrEmail)
{
var user = await _userManager.FindByIdAsync(userId);
if (user == null)
var user = await _userManager.FindByIdOrEmail(idOrEmail);
if (user is null)
{
return this.UserNotFound();
}