mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-12 10:35:39 +00:00
rename guard -> mcaptcha
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
use actix::prelude::*;
|
||||
use actix_web::{web, HttpResponse, Responder};
|
||||
use m_captcha::{
|
||||
use libmcaptcha::{
|
||||
defense::LevelBuilder, master::AddSiteBuilder, DefenseBuilder, MCaptchaBuilder,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -85,10 +85,10 @@ pub async fn get_config(
|
||||
None => Err(ServiceError::TokenNotFound),
|
||||
}
|
||||
}
|
||||
/// Call this when [MCaptcha][m_captcha::MCaptcha] is not in master.
|
||||
/// Call this when [MCaptcha][libmcaptcha::MCaptcha] is not in master.
|
||||
///
|
||||
/// This fn gets mcaptcha config from database, builds [Defense][m_captcha::Defense],
|
||||
/// creates [MCaptcha][m_captcha::MCaptcha] and adds it to [Master][m_captcha::Defense]
|
||||
/// This fn gets mcaptcha config from database, builds [Defense][libmcaptcha::Defense],
|
||||
/// creates [MCaptcha][libmcaptcha::MCaptcha] and adds it to [Master][libmcaptcha::Defense]
|
||||
async fn init_mcaptcha(data: &Data, key: &str) -> ServiceResult<()> {
|
||||
// get levels
|
||||
let levels_fut = sqlx::query_as!(
|
||||
@@ -151,7 +151,7 @@ async fn init_mcaptcha(data: &Data, key: &str) -> ServiceResult<()> {
|
||||
mod tests {
|
||||
use actix_web::http::{header, StatusCode};
|
||||
use actix_web::test;
|
||||
use m_captcha::pow::PoWConfig;
|
||||
use libmcaptcha::pow::PoWConfig;
|
||||
|
||||
use super::*;
|
||||
use crate::tests::*;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! PoW Verification module
|
||||
|
||||
use actix_web::{web, HttpResponse, Responder};
|
||||
use m_captcha::pow::Work;
|
||||
use libmcaptcha::pow::Work;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::errors::*;
|
||||
@@ -54,7 +54,7 @@ pub async fn verify_pow(
|
||||
mod tests {
|
||||
use actix_web::http::{header, StatusCode};
|
||||
use actix_web::test;
|
||||
use m_captcha::pow::PoWConfig;
|
||||
use libmcaptcha::pow::PoWConfig;
|
||||
|
||||
use super::*;
|
||||
use crate::api::v1::pow::get_config::GetConfigPayload;
|
||||
@@ -125,7 +125,7 @@ mod tests {
|
||||
format!(
|
||||
"{}",
|
||||
ServiceError::CaptchaError(
|
||||
m_captcha::errors::CaptchaError::StringNotFound
|
||||
libmcaptcha::errors::CaptchaError::StringNotFound
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -137,9 +137,9 @@ mod tests {
|
||||
// .await;
|
||||
// assert_eq!(pow_config_resp.status(), StatusCode::OK);
|
||||
// I'm not checking for errors because changing work.result triggered
|
||||
// InssuficientDifficulty, which is possible becuase m_captcha calculates
|
||||
// InssuficientDifficulty, which is possible becuase libmcaptcha calculates
|
||||
// difficulty with the submitted result. Besides, this endpoint is merely
|
||||
// propagating errors from m_captcha and m_captcha has tests covering the
|
||||
// propagating errors from libmcaptcha and libmcaptcha has tests covering the
|
||||
// pow aspects ¯\_(ツ)_/¯
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! PoW success token module
|
||||
|
||||
use actix_web::{web, HttpResponse, Responder};
|
||||
use m_captcha::cache::messages::VerifyCaptchaResult;
|
||||
use libmcaptcha::cache::messages::VerifyCaptchaResult;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::errors::*;
|
||||
@@ -55,8 +55,8 @@ pub async fn validate_captcha_token(
|
||||
mod tests {
|
||||
use actix_web::http::{header, StatusCode};
|
||||
use actix_web::test;
|
||||
use m_captcha::pow::PoWConfig;
|
||||
use m_captcha::pow::Work;
|
||||
use libmcaptcha::pow::PoWConfig;
|
||||
use libmcaptcha::pow::Work;
|
||||
|
||||
use super::*;
|
||||
use crate::api::v1::pow::get_config::GetConfigPayload;
|
||||
|
||||
Reference in New Issue
Block a user