From 85d1503ac2c0a0cc83e5c0634be11fdfcdf209ce Mon Sep 17 00:00:00 2001 From: Luca Palmieri Date: Wed, 2 Feb 2022 15:21:09 +0000 Subject: [PATCH] Update session/cookie-auth to v4 (#492) Co-authored-by: Rob Ede --- session/cookie-auth/Cargo.toml | 8 ++++---- session/cookie-auth/src/main.rs | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/session/cookie-auth/Cargo.toml b/session/cookie-auth/Cargo.toml index 142daa1e..90265dfe 100644 --- a/session/cookie-auth/Cargo.toml +++ b/session/cookie-auth/Cargo.toml @@ -4,7 +4,7 @@ version = "1.0.0" edition = "2021" [dependencies] -actix-web = "3" -actix-identity = "0.3" -env_logger = "0.8" -rand = "0.7" +actix-web = "4.0.0-beta.21" +actix-identity = "0.4.0-beta.8" +env_logger = "0.9.0" +rand = "0.8.4" diff --git a/session/cookie-auth/src/main.rs b/session/cookie-auth/src/main.rs index 11ce5b7b..175c74c6 100644 --- a/session/cookie-auth/src/main.rs +++ b/session/cookie-auth/src/main.rs @@ -12,12 +12,16 @@ async fn index(id: Identity) -> String { async fn login(id: Identity) -> HttpResponse { id.remember("user1".to_owned()); - HttpResponse::Found().header("location", "/").finish() + HttpResponse::Found() + .insert_header(("location", "/")) + .finish() } async fn logout(id: Identity) -> HttpResponse { id.forget(); - HttpResponse::Found().header("location", "/").finish() + HttpResponse::Found() + .insert_header(("location", "/")) + .finish() } #[actix_web::main]