mirror of
				https://github.com/nitnelave/lldap.git
				synced 2023-04-12 14:25:13 +00:00 
			
		
		
		
	app: Fix login cookie expiration format
This commit is contained in:
		
							parent
							
								
									6f54f57d20
								
							
						
					
					
						commit
						8ac6861d15
					
				@ -23,11 +23,14 @@ pub fn set_cookie(cookie_name: &str, value: &str, expiration: &DateTime<Utc>) ->
 | 
				
			|||||||
            d.dyn_into::<web_sys::HtmlDocument>()
 | 
					            d.dyn_into::<web_sys::HtmlDocument>()
 | 
				
			||||||
                .map_err(|_| anyhow!("Document is not an HTMLDocument"))
 | 
					                .map_err(|_| anyhow!("Document is not an HTMLDocument"))
 | 
				
			||||||
        })?;
 | 
					        })?;
 | 
				
			||||||
    doc.set_cookie(&format!(
 | 
					    let cookie_string = format!(
 | 
				
			||||||
        "{}={};expires={};sameSite=Strict",
 | 
					        "{}={}; expires={}; sameSite=Strict; path=/",
 | 
				
			||||||
        cookie_name, value, expiration
 | 
					        cookie_name,
 | 
				
			||||||
    ))
 | 
					        value,
 | 
				
			||||||
    .map_err(|_| anyhow!("Could not set cookie"))
 | 
					        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>> {
 | 
					pub fn get_cookie(cookie_name: &str) -> Result<Option<String>> {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user