Skip to content

Commit

Permalink
Merge pull request #3126 from catchpoint/enforce_email_verification
Browse files Browse the repository at this point in the history
fix verification email flow
  • Loading branch information
claud-io authored Dec 9, 2024
2 parents 01bb59a + a188ff8 commit 2ca395e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions www/runtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,13 @@ function buildSelfHost($hosts)
return $selfHostScript;
}

$isFree = !is_null($request_context->getUser()) && $request_context->getUser()->isFree();

// Allow free user to run test only if email is verified
if ($isFree && !$request_context->getUser()->isVerified()) {
$errorTitle = 'Email address is not verified';
$error = 'Please verify your email address to use WebPageTest.';
}

if (!strlen($error) && CheckIp($test) && CheckUrl($test['url']) && CheckRateLimit($test, $error, $errorTitle)) {
$total_runs = Util::getRunCount($test['runs'], $test['fvonly'], $test['lighthouse'], $test['type']);
Expand Down
5 changes: 5 additions & 0 deletions www/src/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ public function isPaid(): bool
($this->payment_status == 'ACTIVE' || $this->isPendingCancelation());
}

public function isFree(): bool
{
return !$this->isPaid() && !$this->isAnon();
}

public function setPaidClient(bool $is_paid): void
{
$this->is_paid_cp_client = $is_paid;
Expand Down

0 comments on commit 2ca395e

Please sign in to comment.