Minor Bugfixes

This commit is contained in:
2026-04-28 20:42:18 +02:00
parent ce86d8bc8f
commit dac2d91213
7 changed files with 111 additions and 20 deletions

View File

@@ -12,7 +12,11 @@ use axum_extra::extract::CookieJar;
use jsonwebtoken::DecodingKey;
use serde_json::json;
use crate::{AppState, cookie::jwt::decode_token, models::LoginModel};
use crate::{
AppState,
cookie::jwt::decode_token,
models::{LoginScheme, User},
};
pub async fn validate_token(
cookies: CookieJar,
@@ -59,7 +63,7 @@ pub async fn validate_token(
(StatusCode::UNAUTHORIZED, Json(error))
})?;
let user = sqlx::query_as::<_, LoginModel>(r#"SELECT * FROM users WHERE id = $1"#)
let user = sqlx::query_as::<_, User>(r#"SELECT * FROM users WHERE id = $1"#)
.bind(uuid)
.fetch_optional(&data.db)
.await