lldap_set_password: Add option to bypass password requirements

This commit is contained in:
stuart938503 2023-09-28 21:39:50 +01:00 committed by GitHub
parent 3fadfb1944
commit ed3be02384
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,10 @@ pub struct CliOpts {
/// New password for the user.
#[clap(short, long)]
pub password: String,
/// Bypass password requirements such as minimum length. Unsafe.
#[clap(long)]
pub bypass_password_policy: bool,
}
fn append_to_url(base_url: &Url, path: &str) -> Url {
@ -97,7 +101,7 @@ pub fn register_finish(
fn main() -> Result<()> {
let opts = CliOpts::parse();
ensure!(
opts.password.len() >= 8,
opts.bypass_password_policy || opts.password.len() >= 8,
"New password is too short, expected at least 8 characters"
);
ensure!(