diff --git a/src/api/v1/mcaptcha/levels.rs b/src/api/v1/mcaptcha/levels.rs index 6b4e1be4..de4efdec 100644 --- a/src/api/v1/mcaptcha/levels.rs +++ b/src/api/v1/mcaptcha/levels.rs @@ -17,7 +17,7 @@ use actix_identity::Identity; use actix_web::{web, HttpResponse, Responder}; use futures::future::try_join_all; -use libmcaptcha::{defense::Level, DefenseBuilder}; +use libmcaptcha::{defense::Level, DefenseBuilder, master::messages::RemoveCaptcha}; use log::debug; use serde::{Deserialize, Serialize}; @@ -190,6 +190,9 @@ async fn update_levels( } try_join_all(futs).await?; + if let Err(ServiceError::CaptchaError(e)) = data.captcha.remove(RemoveCaptcha(payload.key.clone())).await { + log::error!("Deleting captcha key {} while updating it, error: {:?}", &payload.key, e) + } Ok(HttpResponse::Ok()) } @@ -277,7 +280,6 @@ mod tests { let app = get_app!(data).await; // 2. get level - let add_level = get_level_data(); let get_level_resp = test::call_service( &app, diff --git a/src/tests-migrate.rs b/src/tests-migrate.rs index e47127fc..5e592924 100644 --- a/src/tests-migrate.rs +++ b/src/tests-migrate.rs @@ -1,19 +1,19 @@ /* -* Copyright (C) 2021 Aravinth Manivannan -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Affero General Public License as -* published by the Free Software Foundation, either version 3 of the -* License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Affero General Public License for more details. -* -* You should have received a copy of the GNU Affero General Public License -* along with this program. If not, see . -*/ + * Copyright (C) 2021 Aravinth Manivannan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ use std::env; use lazy_static::lazy_static;