Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Commit cbfa605

Browse files
committed
⬆️ Upgrade cookie
1 parent ddea9dc commit cbfa605

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bytes = "1.5.0"
1313
chrono = { version = "0.4.31", default-features = false, features = ["std", "clock", "serde"] }
1414
chrono-humanize = "0.2.3"
1515
clap = { version = "4.4.5", features = ["derive", "env", "cargo"] }
16-
cookie = "0.17.0"
16+
cookie = "0.18.0"
1717
crc32fast = "1.3.2"
1818
derive_more = { version = "0.99.17", default-features = false, features = ["from"] }
1919
dotenvy = "0.15.7"

src/web/views/authenticate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ pub async fn get(
9494

9595
info!(user.nickname, %user.session_id, "👋 Welcome");
9696
state.session_manager.insert(&user).await?;
97-
let cookie = cookie::Cookie::build(User::SESSION_COOKIE_NAME, user.session_id.to_string())
97+
let cookie = cookie::Cookie::build((User::SESSION_COOKIE_NAME, user.session_id.to_string()))
9898
.http_only(true)
9999
.expires(user.expires_at()?)
100100
.same_site(SameSite::Strict)
101101
.secure(true)
102-
.finish();
102+
.build();
103103

104104
// Workaround for Chrome & Firefox not sending the cookie after the redirect.
105105
let markup = html! {

src/web/views/sign_out.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ pub async fn get(
3131
}
3232
}
3333

34-
let cookie = cookie::Cookie::build(User::SESSION_COOKIE_NAME, "")
34+
let cookie = cookie::Cookie::build(User::SESSION_COOKIE_NAME)
3535
.http_only(true)
3636
.max_age(Duration::new(0, 0))
37-
.finish();
37+
.build();
3838

3939
Ok(([(SET_COOKIE, cookie.to_string())], Redirect::temporary("/")))
4040
}

0 commit comments

Comments
 (0)