Set language cookie even when connected + increase number of concurrent connections when sign in and sign up

This commit is contained in:
Greg Burri 2025-03-10 21:06:09 +01:00
parent b40ee5f765
commit a90c097e2a
5 changed files with 94 additions and 93 deletions

View file

@ -26,10 +26,12 @@ pub async fn set_lang(
let mut jar = CookieJar::from_headers(&headers);
if let Some(user) = user {
connection.set_user_lang(user.id, &ron.lang).await?;
} else {
let cookie = Cookie::build((consts::COOKIE_LANG_NAME, ron.lang)).path("/");
jar = jar.add(cookie);
}
// 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("/");
jar = jar.add(cookie);
Ok((jar, StatusCode::OK))
}