users: set a less restrictive domain on the cookie

Signed-off-by: ATechnoHazard <amolele@gmail.com>
This commit is contained in:
Amogh Lele 2020-09-25 09:54:19 +05:30
parent ebe7bf4594
commit 9e7fc110ea
No known key found for this signature in database
GPG Key ID: F475143EDEDEBA3C
2 changed files with 2 additions and 3 deletions

View File

@ -1,8 +1,6 @@
use jirachi::collision_resistant::Jirachi;
use jirachi::Wishable;
pub fn get_random_id() -> String {
let mut jirachi = Jirachi::new().unwrap();
jirachi.wish().unwrap()

View File

@ -7,7 +7,8 @@ pub fn get_session_id(ck: &mut Cookies) -> String {
Some(c) => c.value().to_string(),
None => {
let user_id = phonetic_key::get_random_id();
ck.add_private(Cookie::new("session", user_id.clone()));
let cookie = Cookie::build("session", user_id.clone()).domain("katb.in").permanent().finish();
ck.add_private(cookie);
user_id
}
}