diff --git a/src/handlers/admin.rs b/src/handlers/admin.rs index 2d413cf..c699b60 100644 --- a/src/handlers/admin.rs +++ b/src/handlers/admin.rs @@ -89,7 +89,7 @@ pub async fn add_user( .await .context("Failed to insert new user into database")?; - Ok(Redirect::temporary("/__dungeon").into_response()) + Ok(Redirect::to("/__dungeon").into_response()) } pub async fn delete_user( @@ -111,7 +111,7 @@ pub async fn delete_user( .await .context(format!("Failed to delete user with id {}", id))?; - Ok(Redirect::temporary("/__dungeon").into_response()) + Ok(Redirect::to("/__dungeon").into_response()) } #[derive(Deserialize)] @@ -138,5 +138,5 @@ pub async fn change_password( .await .context(format!("Failed to update password for user with id {}", id))?; - Ok(Redirect::temporary("/__dungeon").into_response()) + Ok(Redirect::to("/__dungeon").into_response()) } diff --git a/src/handlers/auth.rs b/src/handlers/auth.rs index c2e3aa7..a649441 100644 --- a/src/handlers/auth.rs +++ b/src/handlers/auth.rs @@ -45,7 +45,7 @@ pub async fn setup_form(State(state): State>) -> Result 0 { - return Ok(Redirect::temporary("/__dungeon/login").into_response()); + return Ok(Redirect::to("/__dungeon/login").into_response()); } Ok(HtmlTemplate(SetupTemplate { error: None }).into_response()) @@ -67,7 +67,7 @@ pub async fn setup_submit( .context("Failed to check user count for setup submit")?; if count.0 > 0 { - return Ok(Redirect::temporary("/__dungeon/login").into_response()); + return Ok(Redirect::to("/__dungeon/login").into_response()); } let hashed = hash(&payload.password, DEFAULT_COST).context("Failed to hash password")?; @@ -80,7 +80,7 @@ pub async fn setup_submit( .await .context("Failed to insert initial admin user")?; - Ok(Redirect::temporary("/__dungeon/login").into_response()) + Ok(Redirect::to("/__dungeon/login").into_response()) } pub async fn login_form() -> impl IntoResponse { @@ -119,7 +119,7 @@ pub async fn login_submit( let mut cookie = Cookie::new("dungeon_session", session_id); cookie.set_path("/"); - return Ok((cookie_jar.add(cookie), Redirect::temporary("/__dungeon")).into_response()); + return Ok((cookie_jar.add(cookie), Redirect::to("/__dungeon")).into_response()); } } @@ -147,7 +147,7 @@ pub async fn logout_submit( Ok(( cookie_jar.remove(remove_cookie), - Redirect::temporary("/__dungeon/login"), + Redirect::to("/__dungeon/login"), ) .into_response()) }