From 243554929859816b242f496f48a593bb9c9a3cac Mon Sep 17 00:00:00 2001 From: eraden Date: Wed, 23 Oct 2024 05:11:58 +0200 Subject: [PATCH] Update --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index f84592e..e0fd3f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -100,16 +100,24 @@ async fn sign_in( .set_ex(uid.to_string(), "1", 60 * 60 * 24) // session exists for 1 day .await .expect("Failed to store session"); - HttpResponse::Ok() + HttpResponse::SeeOther() .cookie( CookieBuilder::new("ses", uid.to_string()) .secure(true) .max_age(Duration::hours(24)) .finish(), ) + .append_header(("location", "/")) .finish() } else { - HttpResponse::Ok().finish() + HttpResponse::BadRequest().body( + SignInForm { + login: payload.login, + not_found: true, + } + .render() + .unwrap_or_default(), + ) } }