diff --git a/Jellyfin.Api/Controllers/UserController.cs b/Jellyfin.Api/Controllers/UserController.cs index 630e9df6ac..50bb8bb2aa 100644 --- a/Jellyfin.Api/Controllers/UserController.cs +++ b/Jellyfin.Api/Controllers/UserController.cs @@ -505,17 +505,17 @@ namespace Jellyfin.Api.Controllers /// /// Initiates the forgot password process for a local user. /// - /// The entered username. + /// The forgot password request containing the entered username. /// Password reset process started. /// A containing a . [HttpPost("ForgotPassword")] [ProducesResponseType(StatusCodes.Status200OK)] - public async Task> ForgotPassword([FromBody] string? enteredUsername) + public async Task> ForgotPassword([FromBody, Required] ForgotPasswordDto forgotPasswordRequest) { var isLocal = HttpContext.IsLocal() || _networkManager.IsInLocalNetwork(HttpContext.GetNormalizedRemoteIp()); - var result = await _userManager.StartForgotPasswordProcess(enteredUsername, isLocal).ConfigureAwait(false); + var result = await _userManager.StartForgotPasswordProcess(forgotPasswordRequest.EnteredUsername, isLocal).ConfigureAwait(false); return result; } diff --git a/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs b/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs new file mode 100644 index 0000000000..b31c6539c6 --- /dev/null +++ b/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace Jellyfin.Api.Models.UserDtos +{ + /// + /// Forgot Password request body DTO. + /// + public class ForgotPasswordDto + { + /// + /// Gets or sets the entered username to have its password reset. + /// + [Required] + public string? EnteredUsername { get; set; } + } +}