Set parameter SameSite to Lax for both cookies *dark_theme* and *lang*
This commit is contained in:
parent
983002b5ec
commit
58e299b337
2 changed files with 5 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ use axum::{
|
||||||
http::{HeaderMap, StatusCode},
|
http::{HeaderMap, StatusCode},
|
||||||
response::{IntoResponse, Result},
|
response::{IntoResponse, Result},
|
||||||
};
|
};
|
||||||
use axum_extra::extract::cookie::{Cookie, CookieJar};
|
use axum_extra::extract::cookie::{Cookie, CookieJar, SameSite};
|
||||||
// use tracing::{event, Level};
|
// use tracing::{event, Level};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
@ -29,7 +29,9 @@ pub async fn set_lang(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always set the cookie even is the user is connected in case of disconnection.
|
// Always set the cookie even is the user is connected in case of disconnection.
|
||||||
let cookie = Cookie::build((consts::COOKIE_LANG_NAME, ron.lang)).path("/");
|
let cookie = Cookie::build((consts::COOKIE_LANG_NAME, ron.lang))
|
||||||
|
.same_site(SameSite::Lax)
|
||||||
|
.path("/");
|
||||||
jar = jar.add(cookie);
|
jar = jar.add(cookie);
|
||||||
|
|
||||||
Ok((jar, StatusCode::OK))
|
Ok((jar, StatusCode::OK))
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ fn set_cookie_dark_theme(dark_theme: bool) {
|
||||||
domain: None,
|
domain: None,
|
||||||
expires: None,
|
expires: None,
|
||||||
secure: false,
|
secure: false,
|
||||||
same_site: wasm_cookies::SameSite::Strict,
|
same_site: wasm_cookies::SameSite::Lax,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue