Profile edit (WIP)
This commit is contained in:
parent
405aa68526
commit
327b2d0a5b
15 changed files with 174 additions and 46 deletions
|
|
@ -16,7 +16,7 @@ use tracing::{event, Level};
|
|||
|
||||
use crate::{config::Config, consts, data::db, email, model, utils, AppState};
|
||||
|
||||
pub mod ron_api;
|
||||
pub mod ron;
|
||||
|
||||
impl axum::response::IntoResponse for db::DBError {
|
||||
fn into_response(self) -> Response {
|
||||
|
|
@ -722,12 +722,26 @@ pub async fn reset_password_post(
|
|||
|
||||
///// EDIT PROFILE /////
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "profile.html")]
|
||||
struct ProfileTemplate {
|
||||
user: Option<model::User>,
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn edit_user(
|
||||
State(connection): State<db::Connection>,
|
||||
Extension(user): Extension<Option<model::User>>,
|
||||
) -> Result<impl IntoResponse> {
|
||||
Ok("todo")
|
||||
) -> Response {
|
||||
if user.is_some() {
|
||||
ProfileTemplate { user }.into_response()
|
||||
} else {
|
||||
MessageTemplate {
|
||||
user: None,
|
||||
message: "Not logged in",
|
||||
}
|
||||
.into_response()
|
||||
}
|
||||
}
|
||||
|
||||
///// 404 /////
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue