mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-18 19:15:10 -04:00
Fixed: Instance Name validation
This commit is contained in:
parent
a3a8f1417d
commit
0be2aee9c3
3 changed files with 4 additions and 3 deletions
|
@ -21,6 +21,7 @@ const requiresRestartKeys = [
|
|||
'bindAddress',
|
||||
'port',
|
||||
'urlBase',
|
||||
'instanceName',
|
||||
'enableSsl',
|
||||
'sslPort',
|
||||
'sslCertPath',
|
||||
|
|
|
@ -62,10 +62,10 @@ namespace NzbDrone.Core.Validation
|
|||
return ruleBuilder.WithState(v => NzbDroneValidationState.Warning);
|
||||
}
|
||||
|
||||
public static IRuleBuilderOptions<T, string> ContainsProwlarr<T>(this IRuleBuilder<T, string> ruleBuilder)
|
||||
public static IRuleBuilderOptions<T, string> StartsOrEndsWithProwlarr<T>(this IRuleBuilder<T, string> ruleBuilder)
|
||||
{
|
||||
ruleBuilder.SetValidator(new NotEmptyValidator(null));
|
||||
return ruleBuilder.SetValidator(new RegularExpressionValidator("prowlarr", RegexOptions.IgnoreCase)).WithMessage("Must contain Prowlarr");
|
||||
return ruleBuilder.SetValidator(new RegularExpressionValidator("^Prowlarr|Prowlarr$")).WithMessage("Must start or end with Prowlarr");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Prowlarr.Api.V1.Config
|
|||
SharedValidator.RuleFor(c => c.Port).ValidPort();
|
||||
|
||||
SharedValidator.RuleFor(c => c.UrlBase).ValidUrlBase();
|
||||
SharedValidator.RuleFor(c => c.InstanceName).ContainsProwlarr().When(c => c.InstanceName.IsNotNullOrWhiteSpace());
|
||||
SharedValidator.RuleFor(c => c.InstanceName).StartsOrEndsWithProwlarr();
|
||||
|
||||
SharedValidator.RuleFor(c => c.Username).NotEmpty().When(c => c.AuthenticationMethod != AuthenticationType.None);
|
||||
SharedValidator.RuleFor(c => c.Password).NotEmpty().When(c => c.AuthenticationMethod != AuthenticationType.None);
|
||||
|
|
Loading…
Add table
Reference in a new issue