use crate::session_state::TypedSession; use crate::utils::{e500, see_other}; use actix_web::http::header::ContentType; use actix_web::HttpResponse; use actix_web_flash_messages::IncomingFlashMessages; use std::fmt::Write; pub async fn change_password_form( session: TypedSession, flash_messages: IncomingFlashMessages, ) -> Result { if session.get_user_id().map_err(e500)?.is_none() { return Ok(see_other("/login")); }; let mut msg_html = String::new(); for m in flash_messages.iter() { writeln!(msg_html, "

{}

", m.content()).unwrap(); } Ok(HttpResponse::Ok() .content_type(ContentType::html()) .body(format!( r#" Change Password {msg_html}



<- Back

"#, ))) }