From b1a3db6cad1f7f1c0777f34cc7ec8fdb610292bb Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 6 Feb 2023 23:09:10 -0600 Subject: [PATCH] Fixed: Settings fail to save for some auth setups (cherry picked from commit a379d0c403449b2623f84aa6851c850971528ff8) --- src/Lidarr.Api.V1/Config/HostConfigController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Lidarr.Api.V1/Config/HostConfigController.cs b/src/Lidarr.Api.V1/Config/HostConfigController.cs index c34fc3132..5656288d1 100644 --- a/src/Lidarr.Api.V1/Config/HostConfigController.cs +++ b/src/Lidarr.Api.V1/Config/HostConfigController.cs @@ -42,8 +42,10 @@ namespace Lidarr.Api.V1.Config SharedValidator.RuleFor(c => c.UrlBase).ValidUrlBase(); SharedValidator.RuleFor(c => c.InstanceName).ContainsLidarr().When(c => c.InstanceName.IsNotNullOrWhiteSpace()); - SharedValidator.RuleFor(c => c.Username).NotEmpty().When(c => c.AuthenticationMethod != AuthenticationType.None); - SharedValidator.RuleFor(c => c.Password).NotEmpty().When(c => c.AuthenticationMethod != AuthenticationType.None); + SharedValidator.RuleFor(c => c.Username).NotEmpty().When(c => c.AuthenticationMethod == AuthenticationType.Basic || + c.AuthenticationMethod == AuthenticationType.Forms); + SharedValidator.RuleFor(c => c.Password).NotEmpty().When(c => c.AuthenticationMethod == AuthenticationType.Basic || + c.AuthenticationMethod == AuthenticationType.Forms); SharedValidator.RuleFor(c => c.SslPort).ValidPort().When(c => c.EnableSsl); SharedValidator.RuleFor(c => c.SslPort).NotEqual(c => c.Port).When(c => c.EnableSsl);