Skip to content

Commit

Permalink
Show notice for re-connect incase of token decryption fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdharmesh committed Aug 7, 2024
1 parent 19e72d1 commit 1198ebb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1415,8 +1415,18 @@ function mailchimp_sf_create_nonce( $action = -1 ) {
* @return string|bool
*/
function mailchimp_sf_get_access_token() {
$access_token = get_option( 'mailchimp_sf_access_token' );
$access_token = get_option( 'mailchimp_sf_access_token' );
if ( empty( $access_token ) ) {
return false;
}

$data_encryption = new Mailchimp_Data_Encryption();
$access_token = $data_encryption->decrypt( $access_token );

// If decryption fails, display notice to user to re-authenticate.
if ( false === $access_token ) {
update_option( 'mailchimp_sf_auth_error', true );
}

return $data_encryption->decrypt( $access_token );
return $access_token;
}

0 comments on commit 1198ebb

Please sign in to comment.