feat: add email verification system

Co-Authored-By: JustTemmie <git@beaver.mom>
This commit is contained in:
Radical 2025-05-27 21:57:08 +02:00
parent 862e2d6709
commit 83f031779f
14 changed files with 265 additions and 33 deletions

View file

@ -19,7 +19,7 @@ use serde_json::Error as JsonError;
use thiserror::Error;
use tokio::task::JoinError;
use toml::de::Error as TomlError;
use lettre::{address::AddressError, transport::smtp::Error as SmtpError};
use lettre::{error::Error as EmailError, address::AddressError, transport::smtp::Error as SmtpError};
#[derive(Debug, Error)]
pub enum Error {
@ -56,6 +56,8 @@ pub enum Error {
#[error(transparent)]
WsClosed(#[from] actix_ws::Closed),
#[error(transparent)]
EmailError(#[from] EmailError),
#[error(transparent)]
SmtpError(#[from] SmtpError),
#[error(transparent)]
SmtpAddressError(#[from] AddressError),
@ -68,6 +70,8 @@ pub enum Error {
#[error("{0}")]
Forbidden(String),
#[error("{0}")]
TooManyRequests(String),
#[error("{0}")]
InternalServerError(String),
}
@ -87,6 +91,8 @@ impl ResponseError for Error {
Error::BunnyError(BunnyError::NotFound(_)) => StatusCode::NOT_FOUND,
Error::BadRequest(_) => StatusCode::BAD_REQUEST,
Error::Unauthorized(_) => StatusCode::UNAUTHORIZED,
Error::Forbidden(_) => StatusCode::FORBIDDEN,
Error::TooManyRequests(_) => StatusCode::TOO_MANY_REQUESTS,
_ => StatusCode::INTERNAL_SERVER_ERROR,
}
}