From d8abb1ed58f8c33f148d8f37d3526ad8b3086443 Mon Sep 17 00:00:00 2001 From: ATechnoHazard Date: Sat, 26 Sep 2020 11:10:10 +0530 Subject: [PATCH] cookies: change domain to .katb.in and set SameSite to lax Signed-off-by: ATechnoHazard --- src/utils/users.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/users.rs b/src/utils/users.rs index aefc7d9..198a3a9 100644 --- a/src/utils/users.rs +++ b/src/utils/users.rs @@ -1,4 +1,4 @@ -use rocket::http::{Cookie, Cookies}; +use rocket::http::{Cookie, Cookies, SameSite}; use crate::utils::phonetic_key; @@ -7,7 +7,11 @@ pub fn get_session_id(ck: &mut Cookies) -> String { Some(c) => c.value().to_string(), None => { let user_id = phonetic_key::get_random_id(); - let cookie = Cookie::build("session", user_id.clone()).domain("katb.in").permanent().finish(); + let cookie = Cookie::build("session", user_id.clone()) + .domain(".katb.in") + .same_site(SameSite::Lax) + .permanent() + .finish(); ck.add_private(cookie); user_id }