Switched auth_post to accept a form instead of a json

This commit is contained in:
StNicolay 2024-08-03 21:05:28 +03:00
parent 0614c4cad0
commit 94bb1371fa
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D

View File

@ -1,3 +1,4 @@
use axum::Form;
use chrono::TimeDelta; use chrono::TimeDelta;
use crate::{ use crate::{
@ -19,7 +20,7 @@ fn get_exp() -> i64 {
pub async fn post( pub async fn post(
State(state): State<AppState>, State(state): State<AppState>,
Json(payload): Json<Params>, Form(payload): Form<Params>,
) -> Result<Json<Token>, Error> { ) -> Result<Json<Token>, Error> {
let user_id = authenticate_user(&payload.username, &payload.password, &state.pool) let user_id = authenticate_user(&payload.username, &payload.password, &state.pool)
.await .await