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

@@ -6,11 +6,10 @@ use crate::{
use axum::{
Extension, Form,
extract::State,
response::{Html, IntoResponse, Redirect, Response},
response::{IntoResponse, Redirect, Response},
};
use axum_messages::Messages;
use secrecy::{ExposeSecret, SecretString};
use std::fmt::Write;
#[derive(serde::Deserialize)]
pub struct PasswordFormData {
@@ -19,18 +18,6 @@ pub struct PasswordFormData {
pub new_password_check: SecretString,
}
pub async fn change_password_form(messages: Messages) -> Result<Response, AdminError> {
let mut error_html = String::new();
for message in messages {
writeln!(error_html, "<p><i>{}</i></p>", message).unwrap();
}
Ok(Html(format!(
include_str!("html/change_password_form.html"),
error_html
))
.into_response())
}
pub async fn change_password(
Extension(AuthenticatedUser { user_id, username }): Extension<AuthenticatedUser>,
State(AppState {