Basic dashboard for newsletter issue and password systems

This commit is contained in:
Alphonse Paix
2025-09-17 01:47:03 +02:00
parent 626726d206
commit a3533bfde7
6 changed files with 272 additions and 36 deletions

View File

@@ -1,11 +1,25 @@
use crate::authentication::AuthenticatedUser;
use askama::Template;
use axum::{
Extension,
response::{Html, IntoResponse, Response},
};
use uuid::Uuid;
#[derive(Template)]
#[template(path = "../templates/dashboard.html")]
struct DashboardTemplate {
username: String,
idempotency_key: String,
}
pub async fn admin_dashboard(
Extension(AuthenticatedUser { username, .. }): Extension<AuthenticatedUser>,
) -> Response {
Html(format!(include_str!("html/dashboard.html"), username)).into_response()
let idempotency_key = Uuid::new_v4().to_string();
let template = DashboardTemplate {
username,
idempotency_key,
};
Html(template.render().unwrap()).into_response()
}