Skip to content

Commit 2ca395e

Browse files
authored
Merge pull request #3126 from catchpoint/enforce_email_verification
fix verification email flow
2 parents 01bb59a + a188ff8 commit 2ca395e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

www/runtest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,13 @@ function buildSelfHost($hosts)
900900
return $selfHostScript;
901901
}
902902

903+
$isFree = !is_null($request_context->getUser()) && $request_context->getUser()->isFree();
904+
905+
// Allow free user to run test only if email is verified
906+
if ($isFree && !$request_context->getUser()->isVerified()) {
907+
$errorTitle = 'Email address is not verified';
908+
$error = 'Please verify your email address to use WebPageTest.';
909+
}
903910

904911
if (!strlen($error) && CheckIp($test) && CheckUrl($test['url']) && CheckRateLimit($test, $error, $errorTitle)) {
905912
$total_runs = Util::getRunCount($test['runs'], $test['fvonly'], $test['lighthouse'], $test['type']);

www/src/User.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ public function isPaid(): bool
8989
($this->payment_status == 'ACTIVE' || $this->isPendingCancelation());
9090
}
9191

92+
public function isFree(): bool
93+
{
94+
return !$this->isPaid() && !$this->isAnon();
95+
}
96+
9297
public function setPaidClient(bool $is_paid): void
9398
{
9499
$this->is_paid_cp_client = $is_paid;

0 commit comments

Comments
 (0)