indexer specific setting validation

This commit is contained in:
kay.one 2013-08-22 01:08:43 -07:00
commit e4fc0c57b3
11 changed files with 93 additions and 26 deletions

View file

@ -1,4 +1,5 @@
using FluentValidation;
using System.Text.RegularExpressions;
using FluentValidation;
using FluentValidation.Validators;
namespace NzbDrone.Api.Validation
@ -14,5 +15,10 @@ namespace NzbDrone.Api.Validation
{
return ruleBuilder.SetValidator(new EqualValidator(0));
}
public static IRuleBuilderOptions<T, string> HaveHttpProtocol<T>(this IRuleBuilder<T, string> ruleBuilder)
{
return ruleBuilder.SetValidator(new RegularExpressionValidator("^http(s)?://", RegexOptions.IgnoreCase)).WithMessage("must start with http:// or https://");
}
}
}