mirror of
https://github.com/lldap/lldap.git
synced 2024-11-25 09:06:03 +00:00
app: Fix login cookie expiration format
This commit is contained in:
parent
f4edb99379
commit
3df3a96d46
1 changed files with 8 additions and 5 deletions
|
@ -23,11 +23,14 @@ pub fn set_cookie(cookie_name: &str, value: &str, expiration: &DateTime<Utc>) ->
|
|||
d.dyn_into::<web_sys::HtmlDocument>()
|
||||
.map_err(|_| anyhow!("Document is not an HTMLDocument"))
|
||||
})?;
|
||||
doc.set_cookie(&format!(
|
||||
"{}={};expires={};sameSite=Strict",
|
||||
cookie_name, value, expiration
|
||||
))
|
||||
.map_err(|_| anyhow!("Could not set cookie"))
|
||||
let cookie_string = format!(
|
||||
"{}={}; expires={}; sameSite=Strict; path=/",
|
||||
cookie_name,
|
||||
value,
|
||||
expiration.to_rfc2822()
|
||||
);
|
||||
doc.set_cookie(&cookie_string)
|
||||
.map_err(|_| anyhow!("Could not set cookie"))
|
||||
}
|
||||
|
||||
pub fn get_cookie(cookie_name: &str) -> Result<Option<String>> {
|
||||
|
|
Loading…
Reference in a new issue