// SPDX-FileCopyrightText: 2024 Simon Bruder // // SPDX-License-Identifier: AGPL-3.0-or-later use actix_web::middleware::ErrorHandlerResponse; use actix_web::{dev::ServiceResponse, error, HttpResponse}; pub fn redirect_to_login( res: ServiceResponse, ) -> Result, error::Error> { Ok(ErrorHandlerResponse::Response( res.into_response( HttpResponse::SeeOther() .insert_header(("Location", "/login")) .finish() .map_into_right_body(), ), )) }