pub trait UserStore: Send + Sync {
// Required methods
fn find_by_email(&self, email: &str) -> Result<Option<AuthUser>, String>;
fn find_by_id(&self, id: &str) -> Result<Option<AuthUser>, String>;
fn create(
&self,
email: &str,
password_hash: &str,
) -> Result<Option<AuthUser>, String>;
fn set_password_hash(
&self,
id: &str,
password_hash: &str,
) -> Result<(), String>;
fn confirm(&self, id: &str) -> Result<(), String>;
}Available on crate feature
crypto and crate feature mailer and crate feature serde and non-WebAssembly only.Expand description
Accounts: implement it over your users table, or use MemoryUserStore
/ DbUserStore. Errors are messages; the flows answer them 500.
The methods are synchronous: the flows run as a middleware, on the
blocking pool.
Required Methods§
Sourcefn find_by_email(&self, email: &str) -> Result<Option<AuthUser>, String>
fn find_by_email(&self, email: &str) -> Result<Option<AuthUser>, String>
The account with this email (already lower-cased), if any.
Sourcefn find_by_id(&self, id: &str) -> Result<Option<AuthUser>, String>
fn find_by_id(&self, id: &str) -> Result<Option<AuthUser>, String>
The account with this id, if any.
Sourcefn create(
&self,
email: &str,
password_hash: &str,
) -> Result<Option<AuthUser>, String>
fn create( &self, email: &str, password_hash: &str, ) -> Result<Option<AuthUser>, String>
Create an account (not confirmed). Ok(None) when the email is taken.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl UserStore for DbUserStore
Available on crate features
model-mysql or model-postgres or model-sqlite only.