fix(auth): redirect login and logout to homepage instead of timeline

This commit is contained in:
Jon Seager 2026-02-04 17:14:56 +00:00
parent e508af4c52
commit d15d58b32c
No known key found for this signature in database

View file

@ -36,7 +36,7 @@ pub(crate) async fn login_page(
) -> Result<Response, StatusCode> { ) -> Result<Response, StatusCode> {
// Check if already authenticated // Check if already authenticated
if is_authenticated(&state, &cookies).await { if is_authenticated(&state, &cookies).await {
return Ok(Redirect::to("/timeline").into_response()); return Ok(Redirect::to("/").into_response());
} }
let template = LoginTemplate { let template = LoginTemplate {
@ -103,7 +103,7 @@ pub(crate) async fn login_submit(
cookies.add(cookie); cookies.add(cookie);
Ok(Redirect::to("/timeline").into_response()) Ok(Redirect::to("/").into_response())
} }
#[tracing::instrument(skip(state, cookies))] #[tracing::instrument(skip(state, cookies))]
@ -124,7 +124,7 @@ pub(crate) async fn logout(State(state): State<AppState>, cookies: Cookies) -> R
} }
cookies.remove(Cookie::from(SESSION_COOKIE_NAME)); cookies.remove(Cookie::from(SESSION_COOKIE_NAME));
Redirect::to("/timeline") Redirect::to("/")
} }
fn show_login_error(message: &str) -> Result<Response, StatusCode> { fn show_login_error(message: &str) -> Result<Response, StatusCode> {