cookies: change domain to .katb.in and set SameSite to lax
Signed-off-by: ATechnoHazard <amolele@gmail.com>
This commit is contained in:
parent
2aef9cb7a1
commit
d8abb1ed58
@ -1,4 +1,4 @@
|
|||||||
use rocket::http::{Cookie, Cookies};
|
use rocket::http::{Cookie, Cookies, SameSite};
|
||||||
|
|
||||||
use crate::utils::phonetic_key;
|
use crate::utils::phonetic_key;
|
||||||
|
|
||||||
@ -7,7 +7,11 @@ pub fn get_session_id(ck: &mut Cookies) -> String {
|
|||||||
Some(c) => c.value().to_string(),
|
Some(c) => c.value().to_string(),
|
||||||
None => {
|
None => {
|
||||||
let user_id = phonetic_key::get_random_id();
|
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);
|
ck.add_private(cookie);
|
||||||
user_id
|
user_id
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user