-
Notifications
You must be signed in to change notification settings - Fork 96
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
Changes from all commits
917df13
78805f3
14548a0
9e91d66
6ca952f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ public function install_db( $version_to_install = null, $app_token = '' ) { | |
$client_secret = $options->get( 'client_secret' ); | ||
$domain = $options->get( 'domain' ); | ||
$sso = $options->get( 'sso' ); | ||
$cdn_url = $options->get( 'cdn_url' ); | ||
|
||
// Plugin version < 2.2.3 | ||
if ( $this->current_db_version <= 7 ) { | ||
|
@@ -95,7 +94,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 ); | ||
$options->set( 'cache_expiration', 1440 ); | ||
|
||
// Update Client | ||
|
@@ -130,10 +128,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' ) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting removed, no need to migrate anything. |
||
$options->set( 'auth0js-cdn', WPA0_AUTH0_JS_CDN_URL ); | ||
} | ||
|
||
// Update app type and client grant | ||
$client_grant_created = false; | ||
if ( $decoded_token ) { | ||
|
@@ -270,9 +264,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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting removed, no need to migrate anything. |
||
$options->set( 'passwordless_cdn_url', WPA0_LOCK_CDN_URL ); | ||
|
||
// Force passwordless_method to delete | ||
$update_options = $options->get_options(); | ||
unset( $update_options['passwordless_method'] ); | ||
|
@@ -308,6 +299,28 @@ public function install_db( $version_to_install = null, $app_token = '' ) { | |
} | ||
} | ||
|
||
// 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' ) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice automagical upgrade for existing users 👍 |
||
$options->set( 'cdn_url', WPA0_LOCK_CDN_URL ); | ||
$options->set( 'custom_cdn_url', null ); | ||
} else { | ||
$options->set( 'custom_cdn_url', 1 ); | ||
} | ||
|
||
// Nullify and delete all removed options. | ||
$options->set( 'auth0js-cdn', null ); | ||
$options->set( 'passwordless_cdn_url', null ); | ||
$options->set( 'cdn_url_legacy', null ); | ||
|
||
$update_options = $options->get_options(); | ||
unset( $update_options['auth0js-cdn'] ); | ||
unset( $update_options['passwordless_cdn_url'] ); | ||
unset( $update_options['cdn_url_legacy'] ); | ||
update_option( $options->get_options_name(), $update_options ); | ||
} | ||
|
||
$this->current_db_version = AUTH0_DB_VERSION; | ||
update_option( 'auth0_db_version', AUTH0_DB_VERSION ); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filter to allow changing the URL if needed. |
||
ob_start(); | ||
include WPA0_PLUGIN_DIR . 'templates/auth0-sso-handler-lock10.php'; | ||
return $previous_html . ob_get_clean(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ) ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filter to allow changing the URL if needed. |
||
sanitize_text_field( $this->a0_options->get( 'client_id' ) ), | ||
sanitize_text_field( $this->a0_options->get_auth_domain() ), | ||
esc_url( $this->a0_options->get_wp_auth0_url( $protocol ) ) | ||
|
There was a problem hiding this comment.
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.