| @@ -55,9 +55,9 @@ | ||
| 55 | 55 | * The notice/form HTML for the current request, or '' when there is nothing to show. |
| 56 | 56 | */ |
| 57 | 57 | public static function render(): string |
| 58 | 58 | { |
| 59 | - if (!is_user_logged_in()) { | |
| 59 | + if (!is_user_logged_in() || !EmailVerificationService::isEnabled()) { | |
| 60 | 60 | return ''; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $status = Arr::get($_GET, EmailClaimService::QUERY_STATUS, ''); |
| @@ -77,8 +77,14 @@ | ||
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $offer = $token ? null : EmailClaimService::getOffer(); |
| 81 | + if (!$offer && in_array($status, ['stale', 'expired'], true)) { | |
| 82 | + // Nothing can be requested, so never point at a send button that is not rendered. | |
| 83 | + $status = EmailVerificationService::isRequired(get_current_user_id()) | |
| 84 | + ? (EmailClaimService::isEnabled() ? 'conflict' : 'disabled') | |
| 85 | + : 'link_used'; | |
| 86 | + } | |
| 81 | 87 | $progress = CustomerRecoveryService::progress(get_current_user_id()); |
| 82 | 88 | if (!$token && !EmailVerificationService::isRequired(get_current_user_id())) { |
| 83 | 89 | if (!$offer && in_array($status, ['sent', 'confirmed'], true)) { |
| 84 | 90 | $status = ''; // A previously opened send-link URL is no longer current. |
| @@ -114,8 +120,9 @@ | ||
| 114 | 120 | 'send_failed' => __('The confirmation email could not be sent. Please try again.', 'fluent-cart'), |
| 115 | 121 | 'expired' => __('This confirmation link has expired. Request a new one below.', 'fluent-cart'), |
| 116 | 122 | 'wrong_account' => __('Sign in to the account that requested this confirmation link.', 'fluent-cart'), |
| 117 | 123 | 'stale' => __('Your account has changed since this link was sent. Request a new one below.', 'fluent-cart'), |
| 124 | + 'link_used' => __('This confirmation link is no longer needed. Your email address is already confirmed.', 'fluent-cart'), | |
| 118 | 125 | 'conflict' => __('This address belongs to another customer account. Please contact the store.', 'fluent-cart'), |
| 119 | 126 | 'invalid' => __('This confirmation link is not valid.', 'fluent-cart'), |
| 120 | 127 | 'disabled' => __('Email confirmation is not available.', 'fluent-cart'), |
| 121 | 128 | 'unavailable' => __('There is nothing to confirm for this account.', 'fluent-cart'), |
| @@ -124,9 +131,9 @@ | ||
| 124 | 131 | |
| 125 | 132 | return (string) App::make('view')->make('frontend.customer.email_claim', [ |
| 126 | 133 | 'message' => Arr::get($messages, $status, ''), |
| 127 | 134 | 'is_sent' => $status === 'sent', |
| 128 | - 'is_error' => $status && !in_array($status, ['sent', 'confirmed', 'recovering'], true), | |
| 135 | + 'is_error' => $status && !in_array($status, ['sent', 'confirmed', 'recovering', 'link_used'], true), | |
| 129 | 136 | 'offer_email' => $offer ? $offer['to'] : '', |
| 130 | 137 | 'offer_reason' => $offer ? $offer['reason'] : '', |
| 131 | 138 | 'confirm_email' => $confirmEmail, |
| 132 | 139 | 'token' => $token, |