pub struct EmailPassword { /* private fields */ }Expand description
Email and password sign-in. Off unless .email_password(..) is called.
Implementations§
Source§impl EmailPassword
impl EmailPassword
Sourcepub fn revokes_sessions_on_password_reset(&self) -> bool
pub fn revokes_sessions_on_password_reset(&self) -> bool
Whether a password reset signs the user out everywhere, for plugins that reset passwords.
Sourcepub fn requires_email_verification(&self) -> bool
pub fn requires_email_verification(&self) -> bool
Whether sign-in needs a verified email, for plugins that sign in with a password.
Sourcepub fn max_password_len(&self) -> usize
pub fn max_password_len(&self) -> usize
The longest password accepted, for plugins that check passwords.
pub fn min_password_length(self, n: usize) -> Self
pub fn max_password_length(self, n: usize) -> Self
Sourcepub fn require_email_verification(self, on: bool) -> Self
pub fn require_email_verification(self, on: bool) -> Self
Sign-in fails with EMAIL_NOT_VERIFIED until the user verifies. Needs a mailer.
Sourcepub fn auto_sign_in(self, on: bool) -> Self
pub fn auto_sign_in(self, on: bool) -> Self
Sign-up returns a session (default true). Ignored when verification is required.
Sourcepub fn revoke_sessions_on_password_reset(self, on: bool) -> Self
pub fn revoke_sessions_on_password_reset(self, on: bool) -> Self
Whether a password reset signs the user out everywhere (default true), so a reset after a compromise also ends the attacker’s sessions. Better Auth defaults to false.
pub fn reset_password_ttl(self, ttl: Duration) -> Self
Sourcepub fn password_policy(
self,
policy: impl Fn(&str) -> bool + Send + Sync + 'static,
) -> Self
pub fn password_policy( self, policy: impl Fn(&str) -> bool + Send + Sync + 'static, ) -> Self
Extra check on new passwords; returning false answers PASSWORD_TOO_WEAK.
pub fn hasher(self, hasher: impl PasswordHasher) -> Self
Sourcepub fn max_concurrent_hashes(self, n: usize) -> Self
pub fn max_concurrent_hashes(self, n: usize) -> Self
How many password hashes run at once at most (default: the number of CPUs). Each
holds the hasher’s memory until it finishes (19 MiB for argon2id, 32 MiB for
BetterAuthScrypt), so this bounds what a burst of sign-ins can allocate.