Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix verification email flow #3126

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading