mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-06-07 14:46:40 +00:00
routes updated
This commit is contained in:
parent
c776092023
commit
1b0dfd8082
@ -55,8 +55,8 @@ mod tests {
|
|||||||
const NAME: &str = "powverifyusr";
|
const NAME: &str = "powverifyusr";
|
||||||
const PASSWORD: &str = "testingpas";
|
const PASSWORD: &str = "testingpas";
|
||||||
const EMAIL: &str = "verifyuser@a.com";
|
const EMAIL: &str = "verifyuser@a.com";
|
||||||
const VERIFY_URL: &str = "/api/v1/mcaptcha/pow/verify";
|
const VERIFY_URL: &str = "/api/v1/pow/verify";
|
||||||
const GET_URL: &str = "/api/v1/mcaptcha/pow/config";
|
const GET_URL: &str = "/api/v1/pow/config";
|
||||||
// const UPDATE_URL: &str = "/api/v1/mcaptcha/domain/token/duration/update";
|
// const UPDATE_URL: &str = "/api/v1/mcaptcha/domain/token/duration/update";
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ pub struct CaptchaValidateResp {
|
|||||||
|
|
||||||
// API keys are mcaptcha actor names
|
// API keys are mcaptcha actor names
|
||||||
|
|
||||||
#[post("/api/v1/pow/siteverify")]
|
#[post("/siteverify")]
|
||||||
pub async fn validate_captcha_token(
|
pub async fn validate_captcha_token(
|
||||||
payload: web::Json<VerifyCaptchaResult>,
|
payload: web::Json<VerifyCaptchaResult>,
|
||||||
data: web::Data<Data>,
|
data: web::Data<Data>,
|
||||||
@ -61,8 +61,8 @@ mod tests {
|
|||||||
const NAME: &str = "enterprisetken";
|
const NAME: &str = "enterprisetken";
|
||||||
const PASSWORD: &str = "testingpas";
|
const PASSWORD: &str = "testingpas";
|
||||||
const EMAIL: &str = "verifyuser@enter.com";
|
const EMAIL: &str = "verifyuser@enter.com";
|
||||||
const VERIFY_CAPTCHA_URL: &str = "/api/v1/mcaptcha/pow/verify";
|
const VERIFY_CAPTCHA_URL: &str = "/api/v1/pow/verify";
|
||||||
const GET_URL: &str = "/api/v1/mcaptcha/pow/config";
|
const GET_URL: &str = "/api/v1/pow/config";
|
||||||
const VERIFY_TOKEN_URL: &str = "/api/v1/pow/siteverify";
|
const VERIFY_TOKEN_URL: &str = "/api/v1/pow/siteverify";
|
||||||
// const UPDATE_URL: &str = "/api/v1/mcaptcha/domain/token/duration/update";
|
// const UPDATE_URL: &str = "/api/v1/mcaptcha/domain/token/duration/update";
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ impl Server {
|
|||||||
if let Some(prefix) = self.url_prefix.clone() {
|
if let Some(prefix) = self.url_prefix.clone() {
|
||||||
self.url_prefix = Some(prefix.trim().into());
|
self.url_prefix = Some(prefix.trim().into());
|
||||||
if prefix.trim().is_empty() {
|
if prefix.trim().is_empty() {
|
||||||
panic!("URL prefix is set to empty string")
|
self.url_prefix = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,13 +183,8 @@ mod tests {
|
|||||||
assert!(settings.server.url_prefix.is_none());
|
assert!(settings.server.url_prefix.is_none());
|
||||||
settings.server.url_prefix = Some("test".into());
|
settings.server.url_prefix = Some("test".into());
|
||||||
settings.server.check_url_prefix();
|
settings.server.check_url_prefix();
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[should_panic]
|
|
||||||
fn url_prefix_panic_test() {
|
|
||||||
let mut settings = Settings::new().unwrap();
|
|
||||||
settings.server.url_prefix = Some(" ".into());
|
settings.server.url_prefix = Some(" ".into());
|
||||||
settings.server.check_url_prefix();
|
settings.server.check_url_prefix();
|
||||||
|
assert!(settings.server.url_prefix.is_none());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user