Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

License check fails when multiple uplink plugins exist #22

Open
jamesckemp opened this issue Aug 3, 2023 · 0 comments
Open

License check fails when multiple uplink plugins exist #22

jamesckemp opened this issue Aug 3, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jamesckemp
Copy link
Contributor

Steps to reproduce:

  1. Install 2 uplink-based plugins (Flux and Account Pages on feature/uplink branches).
  2. Go to the settings pages of whichever plugin is loaded last (Account Pages in the above example).
  3. Try to validate a license key.

Issue:

The license check will fail because the nonce is invalid.

The ajax check is added here: https://github.com/stellarwp/uplink/blob/main/src/Uplink/Admin/Provider.php#L41

It's always added with the same ajax action name, regardless of which plugin loads it. As such, when it's checking the nonce, it's checking it against whichever plugin loaded it first (Flux, in this case). Subsequently, the nonce check fails.

Potential solution:

We likely need each plugin to have its own ajax method (using the group name from Config). We can then pass the same group name to the js file with localize_script.

The scripts will all need unique, plugin-based handles, too: https://github.com/stellarwp/uplink/blob/main/src/Uplink/Admin/License_Field.php#L94

Note that notices.js will also only ever be loaded from the first plugin. The way this works means it isn't an issue, however, there could be a conflict in the future if that script is being loaded from an outdated plugin. We likely want to use plugin-specific handles for all scripts?

@jamesckemp jamesckemp added the bug Something isn't working label Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant