Inline generateToken for clarity

The only thing Security::generateToken was providing was a default value
 for the $action, which created a pattern of using the same $action
 everywhere, which may not be the best way to go.

 Since it was essentially a wrapper for WP's built-in nonce functions,
 it seemed clearer to use those functions directly to be more explicit
 about how we're handling tokens.

[MAILPOET-2030]
This commit is contained in:
John Oleksowicz
2022-03-25 12:01:48 -05:00
committed by Veljko V
parent ed87d1cace
commit fc1f3e6dc2
6 changed files with 11 additions and 20 deletions

View File

@@ -7,7 +7,6 @@ use MailPoet\Config\Renderer as TemplateRenderer;
use MailPoet\Entities\FormEntity;
use MailPoet\Subscribers\SubscribersRepository;
use MailPoet\Subscribers\SubscriberSubscribeController;
use MailPoet\Util\Security;
use MailPoet\WP\Functions as WPFunctions;
class DisplayFormInWPContent {
@@ -188,7 +187,7 @@ class DisplayFormInWPContent {
}
// generate security token
$templateData['token'] = Security::generateToken();
$templateData['token'] = $this->wp->wpCreateNonce('mailpoet_token');
// add API version
$templateData['api_version'] = API::CURRENT_VERSION;