pub struct PasswordPolicy {
pub min_length: usize,
pub require_uppercase: bool,
pub require_lowercase: bool,
pub require_digit: bool,
pub require_special: bool,
pub history_size: usize,
}Expand description
Password complexity enforcement policy.
Fields§
§min_length: usizeMinimum password length
require_uppercase: boolRequire at least one uppercase letter
require_lowercase: boolRequire at least one lowercase letter
require_digit: boolRequire at least one digit
require_special: boolRequire at least one special character
history_size: usizeMaximum number of previous passwords to remember
Implementations§
Source§impl PasswordPolicy
impl PasswordPolicy
Sourcepub const fn default_policy() -> Self
pub const fn default_policy() -> Self
Default password policy: 8 chars, upper+lower+digit required.
Sourcepub fn validate_password(&self, password: &str) -> Result<(), KernelError>
pub fn validate_password(&self, password: &str) -> Result<(), KernelError>
Validate a password against this policy.
Returns Ok(()) if the password meets all requirements, or
Err with a description of the first failing requirement.
Trait Implementations§
Source§impl Clone for PasswordPolicy
impl Clone for PasswordPolicy
Source§fn clone(&self) -> PasswordPolicy
fn clone(&self) -> PasswordPolicy
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PasswordPolicy
impl Debug for PasswordPolicy
impl Copy for PasswordPolicy
Auto Trait Implementations§
impl Freeze for PasswordPolicy
impl RefUnwindSafe for PasswordPolicy
impl Send for PasswordPolicy
impl Sync for PasswordPolicy
impl Unpin for PasswordPolicy
impl UnwindSafe for PasswordPolicy
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)