mirror of https://github.com/jellyfin/jellyfin.git
Add Dto to ForgotPassword
This commit is contained in:
parent
226316a486
commit
fed58a0327
|
@ -505,17 +505,17 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initiates the forgot password process for a local user.
|
/// Initiates the forgot password process for a local user.
|
||||||
/// </summary>
|
/// </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>
|
/// <response code="200">Password reset process started.</response>
|
||||||
/// <returns>A <see cref="Task"/> containing a <see cref="ForgotPasswordResult"/>.</returns>
|
/// <returns>A <see cref="Task"/> containing a <see cref="ForgotPasswordResult"/>.</returns>
|
||||||
[HttpPost("ForgotPassword")]
|
[HttpPost("ForgotPassword")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[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()
|
var isLocal = HttpContext.IsLocal()
|
||||||
|| _networkManager.IsInLocalNetwork(HttpContext.GetNormalizedRemoteIp());
|
|| _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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue