cookies: change domain to .katb.in and set SameSite to lax

Signed-off-by: ATechnoHazard <amolele@gmail.com>
This commit is contained in:
Amogh Lele 2020-09-26 11:10:10 +05:30
parent 2aef9cb7a1
commit d8abb1ed58
No known key found for this signature in database
GPG Key ID: F475143EDEDEBA3C

View File

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