diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-09-25 20:06:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-25 20:06:53 +0200 |
| commit | b41da8e5d74da22d8f58a8bb4e8275c4fb4df5cf (patch) | |
| tree | 29a01825b60cac727ac30ac4be7975445f5f97d4 | |
| parent | 7ee57a07a7a28ff36213cac36636f367470b1af7 (diff) | |
| parent | fed58a0327efe29905376cdbdd3e51b0a9598bfe (diff) | |
Merge pull request #4209 from cvium/fix_forgotpassword
Add Dto to ForgotPassword
| -rw-r--r-- | Jellyfin.Api/Controllers/UserController.cs | 6 | ||||
| -rw-r--r-- | Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/Jellyfin.Api/Controllers/UserController.cs b/Jellyfin.Api/Controllers/UserController.cs index 630e9df6a..50bb8bb2a 100644 --- a/Jellyfin.Api/Controllers/UserController.cs +++ b/Jellyfin.Api/Controllers/UserController.cs @@ -505,17 +505,17 @@ namespace Jellyfin.Api.Controllers /// <summary> /// Initiates the forgot password process for a local user. /// </summary> - /// <param name="enteredUsername">The entered username.</param> + /// <param name="forgotPasswordRequest">The forgot password request containing the entered username.</param> /// <response code="200">Password reset process started.</response> /// <returns>A <see cref="Task"/> containing a <see cref="ForgotPasswordResult"/>.</returns> [HttpPost("ForgotPassword")] [ProducesResponseType(StatusCodes.Status200OK)] - public async Task<ActionResult<ForgotPasswordResult>> ForgotPassword([FromBody] string? enteredUsername) + public async Task<ActionResult<ForgotPasswordResult>> 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 000000000..b31c6539c --- /dev/null +++ b/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace Jellyfin.Api.Models.UserDtos +{ + /// <summary> + /// Forgot Password request body DTO. + /// </summary> + public class ForgotPasswordDto + { + /// <summary> + /// Gets or sets the entered username to have its password reset. + /// </summary> + [Required] + public string? EnteredUsername { get; set; } + } +} |
