- Add EmailTokenService for handling email verification and password reset tokens. - Create EmailService for sending verification and reset emails via SMTP. - Update AuthService to handle email verification status during login. - Modify user registration to redirect to a check email screen instead of issuing a token. - Implement resend verification email functionality. - Add deep link handling for email verification and password reset in the mobile app. - Update mobile app routes and components to support new email verification flow. - Enhance error handling for unverified emails during login attempts. - Update configuration to include SMTP settings for email service.
45 lines
1.2 KiB
Rust
45 lines
1.2 KiB
Rust
use dotenvy::dotenv;
|
|
use sqlx::postgres::PgPoolOptions;
|
|
use std::net::SocketAddr;
|
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
|
|
|
|
mod adapters;
|
|
mod application;
|
|
mod config;
|
|
mod domain;
|
|
mod error;
|
|
mod infrastructure;
|
|
mod ports;
|
|
mod router;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
dotenv().ok();
|
|
|
|
tracing_subscriber::registry()
|
|
.with(EnvFilter::try_from_default_env().unwrap_or_else(|_| "meowspool=debug,tower_http=debug".into()))
|
|
.with(tracing_subscriber::fmt::layer())
|
|
.init();
|
|
|
|
let config = config::Config::from_env()?;
|
|
|
|
tracing::info!("Connecting to database...");
|
|
let db_pool = PgPoolOptions::new()
|
|
.max_connections(10)
|
|
.connect(&config.database_url)
|
|
.await?;
|
|
|
|
tracing::info!("Running migrations...");
|
|
sqlx::migrate!("./migrations").run(&db_pool).await?;
|
|
|
|
let app = router::build(db_pool, config.clone());
|
|
|
|
let addr: SocketAddr = format!("{}:{}", config.host, config.port).parse()?;
|
|
tracing::info!("Server listening on {}", addr);
|
|
|
|
let listener = tokio::net::TcpListener::bind(addr).await?;
|
|
axum::serve(listener, app).await?;
|
|
|
|
Ok(())
|
|
}
|