cookies: set secure

Signed-off-by: ATechnoHazard <amolele@gmail.com>
This commit is contained in:
Amogh Lele 2020-09-26 12:30:42 +05:30
parent 84e3def3f8
commit 97f66956ba
No known key found for this signature in database
GPG Key ID: F475143EDEDEBA3C
2 changed files with 4 additions and 3 deletions

View File

@ -9,12 +9,12 @@ pub mod user;
pub fn fuel(rocket: Rocket) -> Rocket {
let mut rocket = rocket;
let mut cors_options = CorsOptions::default();
let mut cors_options = CorsOptions::default().allow_credentials(true);
cors_options.expose_headers.insert("Set-Cookie".to_owned());
cors_options.allow_credentials(true);
let cors = cors_options.to_cors().unwrap();
rocket = health::fuel(rocket);
rocket = paste::fuel(rocket);
rocket = user::fuel(rocket);
rocket.attach(cors_options.to_cors().unwrap())
rocket.attach(cors)
}

View File

@ -10,6 +10,7 @@ pub fn get_session_id(ck: &mut Cookies) -> String {
let cookie = Cookie::build("session", user_id.clone())
.domain(".katb.in")
.same_site(SameSite::Lax)
.secure(true)
.permanent()
.finish();
ck.add_private(cookie);