Fixed: Do not require SSL Cert Hash on Linux/OS X

pull/3113/head
Mark McDowall 11 years ago
parent 6d8b38366f
commit 007f96677c

@ -1,7 +1,9 @@
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using FluentValidation; using FluentValidation;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Validation;
using Omu.ValueInjecter; using Omu.ValueInjecter;
namespace NzbDrone.Api.Config namespace NzbDrone.Api.Config
@ -25,8 +27,8 @@ namespace NzbDrone.Api.Config
SharedValidator.RuleFor(c => c.Username).NotEmpty().When(c => c.AuthenticationEnabled); SharedValidator.RuleFor(c => c.Username).NotEmpty().When(c => c.AuthenticationEnabled);
SharedValidator.RuleFor(c => c.Password).NotEmpty().When(c => c.AuthenticationEnabled); SharedValidator.RuleFor(c => c.Password).NotEmpty().When(c => c.AuthenticationEnabled);
SharedValidator.RuleFor(c => c.SslPort).InclusiveBetween(1, 65535).When(c => c.EnableSsl); SharedValidator.RuleFor(c => c.SslPort).ValidPort().When(c => c.EnableSsl);
SharedValidator.RuleFor(c => c.SslCertHash).NotEmpty().When(c => c.EnableSsl); SharedValidator.RuleFor(c => c.SslCertHash).NotEmpty().When(c => c.EnableSsl && OsInfo.IsWindows);
} }
private HostConfigResource GetHostConfig() private HostConfigResource GetHostConfig()

@ -1,7 +1,6 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using FluentValidation; using FluentValidation;
using FluentValidation.Validators; using FluentValidation.Validators;
using NzbDrone.Core.Validation.Paths;
namespace NzbDrone.Api.Validation namespace NzbDrone.Api.Validation
{ {

@ -26,5 +26,10 @@ namespace NzbDrone.Core.Validation
ruleBuilder.SetValidator(new NotEmptyValidator(null)); ruleBuilder.SetValidator(new NotEmptyValidator(null));
return ruleBuilder.SetValidator(new RegularExpressionValidator("^http(?:s)?://[a-z0-9-.]+", RegexOptions.IgnoreCase)).WithMessage("must be valid URL that"); return ruleBuilder.SetValidator(new RegularExpressionValidator("^http(?:s)?://[a-z0-9-.]+", RegexOptions.IgnoreCase)).WithMessage("must be valid URL that");
} }
public static IRuleBuilderOptions<T, int> ValidPort<T>(this IRuleBuilder<T, int> ruleBuilder)
{
return ruleBuilder.SetValidator(new InclusiveBetweenValidator(0, 65535));
}
} }
} }

@ -55,6 +55,7 @@
</div> </div>
</div> </div>
{{#if_windows}}
<div class="control-group advanced-setting"> <div class="control-group advanced-setting">
<label class="control-label">SSL Cert Hash</label> <label class="control-label">SSL Cert Hash</label>
@ -62,6 +63,7 @@
<input type="text" name="sslCertHash"/> <input type="text" name="sslCertHash"/>
</div> </div>
</div> </div>
{{/if_windows}}
</div> </div>
<div class="control-group"> <div class="control-group">

Loading…
Cancel
Save