| 12345678910111213141516171819202122 |
- use actix_web::cookie::{Cookie, SameSite, time::Duration};
- pub fn create_cookie(name: String, value: String) -> Cookie<'static> {
- if cfg!(debug_assertions){
- Cookie::build(name, value)
- .path("/")
- .http_only(true)
- .same_site(SameSite::Lax)
- .secure(false)
- .max_age(Duration::days(90))
- .finish()
- } else {
- Cookie::build(name, value)
- .domain("exmaple.com")
- .path("/")
- .http_only(true)
- .same_site(SameSite::Lax)
- .secure(true)
- .max_age(Duration::days(90))
- .finish()
- }
- }
|