Fix keep challenge
This commit is contained in:
parent
8e8766617a
commit
af9e46c714
2 changed files with 14 additions and 8 deletions
|
|
@ -36,6 +36,6 @@ policy-groups:
|
|||
- name: robots.txt
|
||||
first-line: "^GET /robots.txt "
|
||||
action: allow
|
||||
- name: Favicon
|
||||
first-line: "^GET /favicon.ico "
|
||||
action: allow
|
||||
- name: Test
|
||||
first-line: "^GET /test/[a-z]+/"
|
||||
action: challenge
|
||||
|
|
|
|||
16
src/main.rs
16
src/main.rs
|
|
@ -143,10 +143,9 @@ async fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
let mut allow = false;
|
||||
let mut valid_challenge = false;
|
||||
|
||||
if let (Some(req_challenge), Some(req_proof)) = (req_challenge, req_proof) {
|
||||
let mut allow = false;
|
||||
if let Some(req_challenge) = req_challenge {
|
||||
valid_challenge = challenge::verify_challenge_cookie(
|
||||
req_challenge,
|
||||
&secret,
|
||||
|
|
@ -154,8 +153,15 @@ async fn main() {
|
|||
req_ip,
|
||||
config.challenge_timeout,
|
||||
);
|
||||
allow = valid_challenge
|
||||
&& challenge::check_challenge(req_challenge, req_proof, TARGET_ZEROS);
|
||||
|
||||
if let Some(req_proof) = req_proof {
|
||||
allow = valid_challenge
|
||||
&& challenge::check_challenge(
|
||||
req_challenge,
|
||||
req_proof,
|
||||
TARGET_ZEROS,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if allow {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue