Skip to content

Commit

Permalink
fix windmill.dev cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Jan 30, 2025
1 parent ff3339d commit 997d3ff
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions backend/windmill-api/src/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1724,25 +1724,9 @@ pub async fn create_session_token<'c>(
expire += time::Duration::days(3);
cookie.set_expires(expire);
cookies.add(cookie);
clear_windmill_dev(&cookies).await;
Ok(token)
}

async fn clear_windmill_dev(cookies: &Cookies) {
if !*CLOUD_HOSTED && BASE_URL.read().await.ends_with(".windmill.dev") {
//clear .windmill.dev cookie
let mut cookie = Cookie::new(COOKIE_NAME, "".to_string());
cookie.set_secure(IS_SECURE.read().await.clone());
cookie.set_same_site(Some(tower_cookies::cookie::SameSite::Lax));
cookie.set_http_only(true);
cookie.set_path(COOKIE_PATH);
cookie.set_domain(".windmill.dev");
// set expire in min timestamp
cookie.set_expires(time::OffsetDateTime::UNIX_EPOCH);
cookies.add(cookie);
}
}

async fn create_token(
Extension(db): Extension<DB>,
authed: ApiAuthed,
Expand Down

0 comments on commit 997d3ff

Please sign in to comment.