pub struct RegistrationService { /* private fields */ }Implementations§
Source§impl RegistrationService
impl RegistrationService
pub fn new( configuration: Arc<Configuration>, mailer: Arc<Service>, user_repository: Arc<DbUserRepository>, user_profile_repository: Arc<DbUserProfileRepository>, ) -> Self
Sourcepub async fn register_user(
&self,
registration_form: &RegistrationForm,
api_base_url: &str,
) -> Result<UserId, ServiceError>
pub async fn register_user( &self, registration_form: &RegistrationForm, api_base_url: &str, ) -> Result<UserId, ServiceError>
It registers a new user.
§Errors
This function will return a:
ServiceError::EmailMissingif email is required, but missing.ServiceError::EmailInvalidif supplied email is badly formatted.ServiceError::PasswordsDontMatchif the supplied passwords do not match.ServiceError::PasswordTooShortif the supplied password is too short.ServiceError::PasswordTooLongif the supplied password is too long.ServiceError::UsernameInvalidif the supplied username is badly formatted.ServiceError::FailedToSendVerificationEmailif unable to send the required verification email.- An error if unable to successfully hash the password.
- An error if unable to insert user into the database.
§Panics
This function will panic if the email is required, but missing.
Sourcepub async fn verify_email(&self, token: &str) -> Result<bool, ServiceError>
pub async fn verify_email(&self, token: &str) -> Result<bool, ServiceError>
It verifies the email address of a user via the token sent to the user’s email.
§Errors
This function will return a ServiceError::DatabaseError if unable to
update the user’s email verification status.
Auto Trait Implementations§
impl Freeze for RegistrationService
impl !RefUnwindSafe for RegistrationService
impl Send for RegistrationService
impl Sync for RegistrationService
impl Unpin for RegistrationService
impl !UnwindSafe for RegistrationService
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> 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