src/api2/types.rs: also define PASSWORD_FORMAT and use it correctly

This commit is contained in:
Dietmar Maurer 2020-01-14 11:32:02 +01:00
parent da4a15a351
commit 7e7b781a18
2 changed files with 4 additions and 1 deletions

View File

@ -81,6 +81,9 @@ pub const DNS_NAME_OR_IP_FORMAT: ApiStringFormat =
pub const PROXMOX_USER_ID_FORMAT: ApiStringFormat =
ApiStringFormat::Pattern(&PROXMOX_USER_ID_REGEX);
pub const PASSWORD_FORMAT: ApiStringFormat =
ApiStringFormat::Pattern(&PASSWORD_REGEX);
pub const PVE_CONFIG_DIGEST_SCHEMA: Schema = StringSchema::new(r#"\
Prevent changes if current configuration file has different SHA256 digest.

View File

@ -15,7 +15,7 @@ lazy_static! {
}
pub const REMOTE_PASSWORD_SCHEMA: Schema = StringSchema::new("Password or auth token for remote host.")
.format(&PASSWORD_REGEX)
.format(&PASSWORD_FORMAT)
.min_length(1)
.max_length(1024)
.schema();