Skip to content

Commit

Permalink
Implement review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikrothenberger committed Oct 2, 2024
1 parent 094381b commit e8c0ada
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ pub async fn identity_registration_start() -> Result<IdRegNextStepResult, IdRegS
return Err(IdRegStartError::InvalidCaller);
}

let now = time();
let flow_state = match captcha_required() {
true => captcha_flow_state(time()).await.1,
true => captcha_flow_state(now).await.1,
false => RegistrationFlowState::FinishRegistration {
flow_created_timestamp_ns: time(),
flow_created_timestamp_ns: now,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ fn should_require_captcha_above_threshold_rate() {

// Double the rate of registrations to one per second
// The 20% threshold rate should allow 5 registrations before the captcha kicks in
let flow_principal = test_principal(0);
for _ in 0..5 {
for i in 0..5 {
let flow_principal = test_principal(i);
let result = api_v2::identity_registration_start(&env, canister_id, flow_principal)
.expect("API call failed")
.expect("registration start failed");
Expand All @@ -56,7 +56,7 @@ fn should_require_captcha_above_threshold_rate() {
env.advance_time(Duration::from_secs(1));
}

let result = api_v2::identity_registration_start(&env, canister_id, flow_principal)
let result = api_v2::identity_registration_start(&env, canister_id, test_principal(99))
.expect("API call failed")
.expect("registration start failed");

Expand Down

0 comments on commit e8c0ada

Please sign in to comment.