src/api2/types.rs: define and use PASSWORD_REGEX
This commit is contained in:
parent
ff620a3d1a
commit
da4a15a351
@ -32,6 +32,8 @@ const_regex!{
|
|||||||
pub SHA256_HEX_REGEX = r"^[a-f0-9]{64}$"; // fixme: define in common_regex ?
|
pub SHA256_HEX_REGEX = r"^[a-f0-9]{64}$"; // fixme: define in common_regex ?
|
||||||
pub SYSTEMD_DATETIME_REGEX = r"^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}(:\d{2})?)?$"; // fixme: define in common_regex ?
|
pub SYSTEMD_DATETIME_REGEX = r"^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}(:\d{2})?)?$"; // fixme: define in common_regex ?
|
||||||
|
|
||||||
|
pub PASSWORD_REGEX = r"^[[:^cntrl:]]*$"; // everything but control characters
|
||||||
|
|
||||||
/// Regex for safe identifiers.
|
/// Regex for safe identifiers.
|
||||||
///
|
///
|
||||||
/// This
|
/// This
|
||||||
|
@ -14,9 +14,9 @@ lazy_static! {
|
|||||||
static ref CONFIG: SectionConfig = init();
|
static ref CONFIG: SectionConfig = init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// fixme: define better schemas
|
|
||||||
|
|
||||||
pub const REMOTE_PASSWORD_SCHEMA: Schema = StringSchema::new("Password or auth token for remote host.")
|
pub const REMOTE_PASSWORD_SCHEMA: Schema = StringSchema::new("Password or auth token for remote host.")
|
||||||
|
.format(&PASSWORD_REGEX)
|
||||||
|
.min_length(1)
|
||||||
.max_length(1024)
|
.max_length(1024)
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user