File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1415,8 +1415,18 @@ function mailchimp_sf_create_nonce( $action = -1 ) {
1415
1415
* @return string|bool
1416
1416
*/
1417
1417
function mailchimp_sf_get_access_token () {
1418
- $ access_token = get_option ( 'mailchimp_sf_access_token ' );
1418
+ $ access_token = get_option ( 'mailchimp_sf_access_token ' );
1419
+ if ( empty ( $ access_token ) ) {
1420
+ return false ;
1421
+ }
1422
+
1419
1423
$ data_encryption = new Mailchimp_Data_Encryption ();
1424
+ $ access_token = $ data_encryption ->decrypt ( $ access_token );
1425
+
1426
+ // If decryption fails, display notice to user to re-authenticate.
1427
+ if ( false === $ access_token ) {
1428
+ update_option ( 'mailchimp_sf_auth_error ' , true );
1429
+ }
1420
1430
1421
- return $ data_encryption -> decrypt ( $ access_token ) ;
1431
+ return $ access_token ;
1422
1432
}
You can’t perform that action at this time.
0 commit comments