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

Add ability to generate a new migration token #640

Merged
merged 5 commits into from
Mar 27, 2019

Conversation

joshcanhelp
Copy link
Contributor

@joshcanhelp joshcanhelp commented Mar 25, 2019

Changes

Adds a button to generate a new migration token for user migration setups.

References

Testing

Failed tests for new field and functionality

Manual Steps:

  1. Paste the following in wp-config.php:
define( 'AUTH0_ENV_MIGRATION_WS',  true );
define( 'AUTH0_ENV_MIGRATION_TOKEN', 'THIS_IS_MY_MIGRATION_TOKEN' );
  1. Refresh the plugin settings page and see the constant-based settings:

Screenshot 2019-03-25 16 00 22

  1. Save the settings page
  2. Comment out the AUTH0_ENV_MIGRATION_TOKEN definition added above
  3. Refresh the settings page to see an empty migration token:

Screenshot 2019-03-25 16 05 31

  1. Click the Generate New Migration Token button
  2. See the alert message:

Screenshot 2019-03-25 15 48 33

  1. Click Ok
  2. See "Save or refresh this page to see changes." in the migration token box:

Screenshot 2019-03-25 16 06 04

  1. Refresh the page and see a token value

Screenshot 2019-03-25 16 06 27

  • I included manual testing steps above, if applicable
  • This change adds unit test coverage
  • This change has been tested on WP 5.1.1

Checklist

  • All existing and new tests complete without errors
  • All code quality tools/guidelines in the Contribution guide have been run/followed
  • All active GitHub CI checks have passed

@joshcanhelp joshcanhelp changed the title Failed tests for new migration token functionality Add ability to generate a new migration token Mar 25, 2019
@joshcanhelp joshcanhelp added this to the 3.10.0 milestone Mar 25, 2019
@joshcanhelp joshcanhelp marked this pull request as ready for review March 26, 2019 00:13
@auth0 auth0 deleted a comment from codecov-io Mar 26, 2019
@codecov-io
Copy link

Codecov Report

Merging #640 into master will increase coverage by 0.69%.
The diff coverage is 77.77%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #640      +/-   ##
============================================
+ Coverage     40.02%   40.72%   +0.69%     
- Complexity     1235     1239       +4     
============================================
  Files            51       51              
  Lines          3765     3784      +19     
============================================
+ Hits           1507     1541      +34     
+ Misses         2258     2243      -15
Impacted Files Coverage Δ Complexity Δ
lib/admin/WP_Auth0_Admin.php 0% <0%> (ø) 17 <0> (ø) ⬇️
lib/admin/WP_Auth0_Admin_Basic.php 20.94% <0%> (ø) 28 <0> (ø) ⬇️
lib/admin/WP_Auth0_Admin_Advanced.php 46.17% <95.45%> (+9.2%) 67 <2> (+4) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11afa88...11e0294. Read the comment docs.

};
$.post(wpa0.ajax_url, postData, function() {
$( '#auth0_migration_token' ).text(wpa0.refresh_prompt);
$rotateTokenButton.remove();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kind of odd for buttons to disappear on UIs. Is there a problem with leaving it there in case something went wrong? Or do they really need to refresh the page?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is success-only and doesn't need any data, just a 200 code. Putting the new token in the code block would be nice but would require sending the new token unnecessarily. I can't refresh the page for the user in case there are other changes that have not been saved.

@joshcanhelp joshcanhelp merged commit 34c50e6 into master Mar 27, 2019
@joshcanhelp joshcanhelp deleted the fix-migration-token-empty branch March 27, 2019 21:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants