test
All checks were successful
/ upload (release) Successful in 25s

This commit is contained in:
pavel 2026-02-24 21:37:18 +01:00
commit d703501b78
12 changed files with 4062 additions and 72 deletions

View file

@ -213,20 +213,10 @@ async fn auth_callback(
.await
.map_err(|e| ApiError::internal(&format!("failed to persist user: {e}")))?;
let session_cookie = auth::new_session_cookie(
user.id,
&state.settings.session_secret,
state.settings.cookie_secure,
)
.map_err(|e| ApiError::internal(&e.to_string()))?;
let jwt_token = auth::new_jwt_token(user.id, &state.settings.session_secret)
.map_err(|e| ApiError::internal(&e.to_string()))?;
let mut headers = HeaderMap::new();
headers.append(
header::SET_COOKIE,
session_cookie
.parse()
.map_err(|_| ApiError::internal("failed to set session cookie"))?,
);
headers.append(
header::SET_COOKIE,
auth::clear_oauth_state_cookie(state.settings.cookie_secure)
@ -234,19 +224,11 @@ async fn auth_callback(
.map_err(|_| ApiError::internal("failed to clear oauth state cookie"))?,
);
Ok((headers, Redirect::to("/")))
Ok((headers, Redirect::to(&format!("/?token={}", jwt_token))))
}
async fn auth_logout(State(state): State<AppState>) -> Result<impl IntoResponse, ApiError> {
let mut headers = HeaderMap::new();
headers.append(
header::SET_COOKIE,
auth::clear_session_cookie(state.settings.cookie_secure)
.parse()
.map_err(|_| ApiError::internal("failed to clear session cookie"))?,
);
Ok((StatusCode::NO_CONTENT, headers))
async fn auth_logout() -> Result<impl IntoResponse, ApiError> {
Ok(StatusCode::NO_CONTENT)
}
#[derive(Serialize)]