Refresh nonce via heartbeats [MAILPOET-2839]
This commit is contained in:
@ -84,6 +84,12 @@ class API {
|
||||
'wp_ajax_nopriv_mailpoet',
|
||||
[$this, 'setupAjax']
|
||||
);
|
||||
|
||||
// nonce refreshing via heartbeats
|
||||
WPFunctions::get()->addAction(
|
||||
'wp_refresh_nonces',
|
||||
[$this, 'addTokenToHeartbeatResponse']
|
||||
);
|
||||
}
|
||||
|
||||
public function setupAjax() {
|
||||
@ -234,6 +240,11 @@ class API {
|
||||
);
|
||||
}
|
||||
|
||||
public function addTokenToHeartbeatResponse($response) {
|
||||
$response['mailpoet_token'] = Security::generateToken();
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function addEndpointNamespace($namespace, $version) {
|
||||
if (!empty($this->endpointNamespaces[$version][$namespace])) return;
|
||||
$this->endpointNamespaces[$version][] = $namespace;
|
||||
|
Reference in New Issue
Block a user