Update
This commit is contained in:
parent
8348aae593
commit
2435549298
12
src/main.rs
12
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(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user