1
0
mirror of https://github.com/actix/examples synced 2025-01-22 14:05:55 +01:00

Update session/cookie-auth to v4 (#492)

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
Luca Palmieri 2022-02-02 15:21:09 +00:00 committed by GitHub
parent ff0a06e019
commit 85d1503ac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -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"

View File

@ -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]