ensure log creation for all present action

This commit is contained in:
2026-04-03 16:05:53 +02:00
parent 20efa90e5d
commit e4cccde466
4 changed files with 37 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ use serde::Deserialize;
use crate::{
api::CompositeError,
logs::{LogAction, LogEntry},
users::{
User,
auth::{AuthError, UserAuthRequired, UserAuthenticate},
@@ -80,7 +81,16 @@ pub async fn change_handle(
Form(form): Form<HandleForm>,
) -> Result<Response, CompositeError> {
let mut u = User::authenticate(&headers)?.required()?;
let oldhandle = u.handle.as_str().to_string();
u.set_handle(form.handle)?;
LogEntry::new(
u.clone(),
LogAction::ChangeUserHandle {
id: u.id,
old: oldhandle,
new: u.handle.as_str().to_string(),
},
)?;
Ok(Redirect::to("/user-settings").into_response())
}