pub struct LockConfig {
pub max_attempts: u32,
pub lockout_duration: Duration,
pub attempt_window: Duration,
pub reset_on_success: bool,
pub progressive_lockout: bool,
pub max_lockout_duration: Duration,
pub permanent_lock_threshold: Option<u32>,
}Expand description
Account lock configuration.
Fields§
§max_attempts: u32Maximum failed attempts before locking
lockout_duration: DurationDuration to lock the account
attempt_window: DurationWindow for counting failed attempts
reset_on_success: boolWhether to reset attempts after successful login
progressive_lockout: boolWhether to use progressive lockout (longer each time)
max_lockout_duration: DurationMaximum lockout duration for progressive lockout
permanent_lock_threshold: Option<u32>Number of consecutive lockouts before permanent lock
Implementations§
Source§impl LockConfig
impl LockConfig
Sourcepub fn max_attempts(self, attempts: u32) -> Self
pub fn max_attempts(self, attempts: u32) -> Self
Set maximum failed attempts before locking.
Sourcepub fn lockout_duration(self, duration: Duration) -> Self
pub fn lockout_duration(self, duration: Duration) -> Self
Set lockout duration.
Sourcepub fn attempt_window(self, window: Duration) -> Self
pub fn attempt_window(self, window: Duration) -> Self
Set the window for counting failed attempts.
Sourcepub fn reset_on_success(self, reset: bool) -> Self
pub fn reset_on_success(self, reset: bool) -> Self
Set whether to reset attempts on successful login.
Sourcepub fn progressive_lockout(self, enabled: bool) -> Self
pub fn progressive_lockout(self, enabled: bool) -> Self
Enable/disable progressive lockout.
Sourcepub fn max_lockout_duration(self, duration: Duration) -> Self
pub fn max_lockout_duration(self, duration: Duration) -> Self
Set maximum lockout duration for progressive lockout.
Sourcepub fn permanent_lock_threshold(self, threshold: Option<u32>) -> Self
pub fn permanent_lock_threshold(self, threshold: Option<u32>) -> Self
Set threshold for permanent lock (None to disable).
Trait Implementations§
Source§impl Clone for LockConfig
impl Clone for LockConfig
Source§fn clone(&self) -> LockConfig
fn clone(&self) -> LockConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LockConfig
impl Debug for LockConfig
Auto Trait Implementations§
impl Freeze for LockConfig
impl RefUnwindSafe for LockConfig
impl Send for LockConfig
impl Sync for LockConfig
impl Unpin for LockConfig
impl UnwindSafe for LockConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more