Allow administrator to always change password

This commit is contained in:
David Ullmer
2022-07-04 18:16:36 +02:00
parent 7efa4e38c1
commit 5f3dbd8294
2 changed files with 25 additions and 10 deletions

View File

@@ -282,17 +282,20 @@ namespace Jellyfin.Api.Controllers
}
else
{
var success = await _userManager.AuthenticateUser(
user.Username,
request.CurrentPw,
request.CurrentPw,
HttpContext.GetNormalizedRemoteIp().ToString(),
false,
ignoreParentalSchedule: true).ConfigureAwait(false);
if (success == null)
if (await RequestHelpers.IsUserAdministrator(_authContext, HttpContext.Request).ConfigureAwait(false))
{
return StatusCode(StatusCodes.Status403Forbidden, "Invalid user or password entered.");
var success = await _userManager.AuthenticateUser(
user.Username,
request.CurrentPw,
request.CurrentPw,
HttpContext.GetNormalizedRemoteIp().ToString(),
false,
ignoreParentalSchedule: true).ConfigureAwait(false);
if (success == null)
{
return StatusCode(StatusCodes.Status403Forbidden, "Invalid user or password entered.");
}
}
await _userManager.ChangePassword(user, request.NewPw).ConfigureAwait(false);