From 2fba143828e00b5b9c7214cc105f0feefdc3ea3d Mon Sep 17 00:00:00 2001 From: Dan0sz <18595395+Dan0sz@users.noreply.github.com> Date: Sat, 23 Sep 2023 08:04:47 +0200 Subject: [PATCH] Fixed: fail silently if transient isn't available. --- src/Plugin.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Plugin.php b/src/Plugin.php index 84c739e..8a8cec9 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -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; }