pub trait UserRegistrationRepository: Send + Sync {
type Error;
// Required methods
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistration>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
username: String,
ip_address: Option<IpAddr>,
user_agent: Option<UserAgent>,
post_auth_action: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn set_display_name<'life0, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
display_name: String,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_terms_url<'life0, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
terms_url: Url,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_email_authentication<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
email_authentication: &'life1 UserEmailAuthentication,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set_password<'life0, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
hashed_password: String,
version: u16,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn complete<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
user_registration: UserRegistration,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
A UserRegistrationRepository
helps interacting with [UserRegistration
]
saved in the storage backend
Required Associated Types§
Required Methods§
Sourcefn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistration>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<UserRegistration>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lookup a [UserRegistration
] by its ID
Returns None
if no [UserRegistration
] was found
§Parameters
id
: The ID of the [UserRegistration
] to lookup
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
username: String,
ip_address: Option<IpAddr>,
user_agent: Option<UserAgent>,
post_auth_action: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
username: String,
ip_address: Option<IpAddr>,
user_agent: Option<UserAgent>,
post_auth_action: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a new [UserRegistration
] session
Returns the newly created [UserRegistration
]
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampsusername
: The username of the userip_address
: The IP address of the user agent, if anyuser_agent
: The user agent of the user agent, if anypost_auth_action
: The post auth action to execute after the registration, if any
§Errors
Returns Self::Error
if the underlying repository fails
Sourcefn set_display_name<'life0, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
display_name: String,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_display_name<'life0, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
display_name: String,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the display name of a [UserRegistration
]
Returns the updated [UserRegistration
]
§Parameters
user_registration
: The [UserRegistration
] to updatedisplay_name
: The display name to set
§Errors
Returns Self::Error
if the underlying repository fails or if the
registration is already completed
Sourcefn set_terms_url<'life0, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
terms_url: Url,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_terms_url<'life0, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
terms_url: Url,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the terms URL of a [UserRegistration
]
Returns the updated [UserRegistration
]
§Parameters
user_registration
: The [UserRegistration
] to updateterms_url
: The terms URL to set
§Errors
Returns Self::Error
if the underlying repository fails or if the
registration is already completed
Sourcefn set_email_authentication<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
email_authentication: &'life1 UserEmailAuthentication,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_email_authentication<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
email_authentication: &'life1 UserEmailAuthentication,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set the email authentication code of a [UserRegistration
]
Returns the updated [UserRegistration
]
§Parameters
user_registration
: The [UserRegistration
] to updateemail_authentication
: The [UserEmailAuthentication
] to set
§Errors
Returns Self::Error
if the underlying repository fails or if the
registration is already completed
Sourcefn set_password<'life0, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
hashed_password: String,
version: u16,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_password<'life0, 'async_trait>(
&'life0 mut self,
user_registration: UserRegistration,
hashed_password: String,
version: u16,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the password of a [UserRegistration
]
Returns the updated [UserRegistration
]
§Parameters
user_registration
: The [UserRegistration
] to updatehashed_password
: The hashed password to setversion
: The version of the hashing scheme
§Errors
Returns Self::Error
if the underlying repository fails or if the
registration is already completed
Sourcefn complete<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
user_registration: UserRegistration,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
user_registration: UserRegistration,
) -> Pin<Box<dyn Future<Output = Result<UserRegistration, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Complete a [UserRegistration
]
Returns the updated [UserRegistration
]
§Parameters
clock
: The clock used to generate timestampsuser_registration
: The [UserRegistration
] to complete
§Errors
Returns Self::Error
if the underlying repository fails or if the
registration is already completed