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

Update Lock, Auth0.js; add setting to use default #635

Merged
merged 5 commits into from
Mar 20, 2019

Conversation

joshcanhelp
Copy link
Contributor

@joshcanhelp joshcanhelp commented Mar 18, 2019

Changes

  • Update Lock from v11.5 to v11.14
  • Update Auth0.js from v9.4 to v9.10
  • Remove settings auth0js-cdn, cdn_url_legacy, passwordless_cdn_url
  • Add WP_Auth0_Options::get_lock_url() to get the correct Lock CDN URL based on the new setting.
  • Add auth0_coo_auth0js_url and auth0_sso_auth0js_url to allow overriding the Auth0.js URL based on context used.
  • Add validation for the cdn_url to make sure we have a valid URL to use.
  • Add a setting to use the default Lock CDN URL (updated and tested regularly for new releases) or a custom one.

Custom URL off

Screenshot 2019-03-19 10 50 41

Custom URL on

Screenshot 2019-03-19 10 51 24

References

Testing

Manual testing:

On a new install ...

  1. Go to wp-admin > Auth0 > Settings > Advanced tab
  2. Verify that the "Use Custom Lock JS URL" is off
  3. Turn this setting on
  4. Verify that the "Custom Lock JS URL" appears
  5. Change the URL to a different location like https://cdn.auth0.com/js/lock/11.9/lock.min.js
  6. Make sure Features > "Universal Login Page" is turned off
  7. Click Save Change
  8. Log out
  9. Open your Network tab (Chrome) to view HTTP requests
  10. Go to the wp-login.php page for your site
  11. Verify that the custom URL is loaded
  • 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 relevant assets have been compiled as directed in the Contribution guide, if applicable
  • All active GitHub CI checks have passed

@joshcanhelp joshcanhelp changed the title Failing tests for Lock CDN settings Update Lock, Auth0.js; add setting to use default Mar 18, 2019
@@ -95,7 +95,6 @@ public function install_db( $version_to_install = null, $app_token = '' ) {
// Plugin version < 3.4.0
if ( $this->current_db_version < 15 || 15 === $version_to_install ) {
$options->set( 'cdn_url', WPA0_LOCK_CDN_URL );
$options->set( 'auth0js-cdn', WPA0_AUTH0_JS_CDN_URL );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting removed, no need to migrate anything.

@@ -130,10 +129,6 @@ public function install_db( $version_to_install = null, $app_token = '' ) {
$options->set( 'cdn_url', WPA0_LOCK_CDN_URL );
}

if ( '//cdn.auth0.com/js/auth0/9.0.0/auth0.min.js' === $options->get( 'auth0js-cdn' ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting removed, no need to migrate anything.

@@ -270,9 +265,6 @@ public function install_db( $version_to_install = null, $app_token = '' ) {
$options->set( 'extra_conf', json_encode( $lock_json_decoded ) );
}

// Set passwordless_cdn_url to latest Lock
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting removed, no need to migrate anything.

@@ -619,7 +619,7 @@ public function auth0_sso_footer( $previous_html ) {
return $previous_html;
}

wp_enqueue_script( 'wpa0_auth0js', $this->a0_options->get( 'auth0js-cdn' ) );
wp_enqueue_script( 'wpa0_auth0js', apply_filters( 'auth0_sso_auth0js_url', WPA0_AUTH0_JS_CDN_URL ) );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filter to allow changing the URL if needed.

@@ -128,7 +128,7 @@ protected function coo_fallback() {
var auth0 = new auth0.WebAuth({clientID:"%s",domain:"%s",redirectUri:"%s"});
auth0.crossOriginAuthenticationCallback();
</script></head><body></body></html>',
esc_url( $this->a0_options->get( 'auth0js-cdn' ) ),
esc_url( apply_filters( 'auth0_coo_auth0js_url', WPA0_AUTH0_JS_CDN_URL ) ),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filter to allow changing the URL if needed.

@auth0 auth0 deleted a comment from codecov-io Mar 19, 2019
// 3.10.0
if ( ( $this->current_db_version < 21 && 0 !== $this->current_db_version ) || 21 === $version_to_install ) {

if ( 'https://cdn.auth0.com/js/lock/11.5/lock.min.js' === $options->get( 'cdn_url' ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice automagical upgrade for existing users 👍

@joshcanhelp joshcanhelp marked this pull request as ready for review March 20, 2019 13:40
@auth0 auth0 deleted a comment from codecov-io Mar 20, 2019
@joshcanhelp joshcanhelp merged commit d29984b into master Mar 20, 2019
@joshcanhelp joshcanhelp deleted the update-lock-auth0-js branch March 20, 2019 15:04
@joshcanhelp joshcanhelp added this to the 3.10.0 milestone Mar 29, 2019
@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.

2 participants