Struct torrust_index_backend::services::user::RegistrationService
source · 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::EmailMissing
if email is required, but missing.ServiceError::EmailInvalid
if supplied email is badly formatted.ServiceError::PasswordsDontMatch
if the supplied passwords do not match.ServiceError::PasswordTooShort
if the supplied password is too short.ServiceError::PasswordTooLong
if the supplied password is too long.ServiceError::UsernameInvalid
if the supplied username is badly formatted.ServiceError::FailedToSendVerificationEmail
if 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.
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 !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