Skip to content

Commit

Permalink
Fixed: fail silently if transient isn't available.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan0sz committed Sep 23, 2023
1 parent c56b937 commit 2fba143
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ public function validate_email( $valid_data, $data ) {
$transient_label = sprintf( Ajax::TRANSIENT_LABEL, preg_replace( '/\W/', '_', $email ) );
$result = get_transient( $transient_label );

if ( empty( $result ) ) {
$client = new Client();
$result = $client->verify( $email );
}

// Fail silently on a timeout.
if ( $result['code'] === 408 ) {
/**
* If transient isn't available, this probably means that a logged-in user placed a purchase, without changing
* his/her email. Which is a perfectly valid scenario, which is why we fail silently here. Same goes for time-outs.
*/
if ( empty( $result ) || $result['code'] === 408 ) {
return;
}

Expand Down

0 comments on commit 2fba143

Please sign in to comment.