Askama message template

This commit is contained in:
Alphonse Paix
2025-09-20 00:51:46 +02:00
parent 6ad207d0a4
commit 2b9cf979e8
9 changed files with 29 additions and 33 deletions

View File

@@ -2,7 +2,7 @@ use crate::{
authentication::{self, AuthenticatedUser, Credentials, validate_credentials},
routes::AdminError,
startup::AppState,
templates::SuccessTemplate,
templates::MessageTemplate,
};
use askama::Template;
use axum::{
@@ -47,8 +47,8 @@ pub async fn change_password(
authentication::change_password(user_id, form.new_password, &connection_pool)
.await
.map_err(|e| AdminError::ChangePassword(e.to_string()))?;
let template = SuccessTemplate {
success_message: "Your password has been changed.".to_string(),
let template = MessageTemplate::Success {
message: "Your password has been changed.".to_string(),
};
Ok(Html(template.render().unwrap()).into_response())
}