-
Notifications
You must be signed in to change notification settings - Fork 92
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
Remove deprecated from WP_Auth0_InitialSetup #754
Changes from all commits
2aa2540
830e6e9
228d0a5
70271f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ class WP_Auth0_InitialSetup { | |
protected $a0_options; | ||
protected $connection_profile; | ||
protected $enterprise_connection_step; | ||
protected $consent_step; | ||
protected $adminuser_step; | ||
protected $connections_step; | ||
protected $end_step; | ||
|
@@ -15,53 +14,13 @@ public function __construct( WP_Auth0_Options $a0_options ) { | |
|
||
$this->connection_profile = new WP_Auth0_InitialSetup_ConnectionProfile( $this->a0_options ); | ||
$this->enterprise_connection_step = new WP_Auth0_InitialSetup_EnterpriseConnection( $this->a0_options ); | ||
$this->consent_step = new WP_Auth0_InitialSetup_Consent( $this->a0_options ); | ||
$this->adminuser_step = new WP_Auth0_InitialSetup_AdminUser( $this->a0_options ); | ||
$this->connections_step = new WP_Auth0_InitialSetup_Connections( $this->a0_options ); | ||
$this->end_step = new WP_Auth0_InitialSetup_End( $this->a0_options ); | ||
} | ||
|
||
/** | ||
* @deprecated - 3.10.0, will move add_action calls out of this class in the next major. | ||
* | ||
* @codeCoverageIgnore - Deprecated. | ||
*/ | ||
public function init() { | ||
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. Logic moved to |
||
|
||
add_action( 'init', [ $this, 'init_setup' ], 1 ); | ||
|
||
add_action( 'admin_action_wpauth0_callback_step1', [ $this->connection_profile, 'callback' ] ); | ||
add_action( 'admin_action_wpauth0_callback_step3_social', [ $this->adminuser_step, 'callback' ] ); | ||
|
||
if ( isset( $_REQUEST['page'] ) && 'wpa0-setup' === $_REQUEST['page'] ) { | ||
if ( isset( $_REQUEST['error'] ) ) { | ||
add_action( 'admin_notices', [ $this, 'notify_error' ] ); | ||
} | ||
} | ||
|
||
if ( isset( $_REQUEST['error'] ) && 'cant_create_client' == $_REQUEST['error'] ) { | ||
add_action( 'admin_notices', [ $this, 'cant_create_client_message' ] ); | ||
} | ||
|
||
if ( isset( $_REQUEST['error'] ) && 'cant_create_client_grant' == $_REQUEST['error'] ) { | ||
add_action( 'admin_notices', [ $this, 'cant_create_client_grant_message' ] ); | ||
} | ||
|
||
if ( isset( $_REQUEST['error'] ) && 'cant_exchange_token' == $_REQUEST['error'] ) { | ||
add_action( 'admin_notices', [ $this, 'cant_exchange_token_message' ] ); | ||
} | ||
|
||
if ( isset( $_REQUEST['error'] ) && 'rejected' == $_REQUEST['error'] ) { | ||
add_action( 'admin_notices', [ $this, 'rejected_message' ] ); | ||
} | ||
|
||
if ( isset( $_REQUEST['error'] ) && 'access_denied' == $_REQUEST['error'] ) { | ||
add_action( 'admin_notices', [ $this, 'access_denied' ] ); | ||
} | ||
} | ||
|
||
public function notify_error() { | ||
printf( '<div class="notice notice-error">%s</div>', strip_tags( $_REQUEST['error'] ) ); | ||
printf( '<div class="notice notice-error"><p><strong>%s</strong></p></div>', strip_tags( $_REQUEST['error'] ) ); | ||
} | ||
|
||
public function render_setup_page() { | ||
|
@@ -107,14 +66,13 @@ public function render_setup_page() { | |
|
||
public function cant_create_client_message() { | ||
?> | ||
<div id="message" class="error"> | ||
<div class="notice notice-error"> | ||
jimmyjames marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<p> | ||
<strong> | ||
<?php echo __( 'There was an error creating the Auth0 App. Check the ', 'wp-auth0' ); ?> | ||
<a target="_blank" href="<?php echo admin_url( 'admin.php?page=wpa0-errors' ); ?>"><?php echo __( 'Error log', 'wp-auth0' ); ?></a> | ||
<?php echo __( ' for more information. If the problem persists, please create it manually in the ', 'wp-auth0' ); ?> | ||
<a target="_blank" href="https://manage.auth0.com/#/applications"><?php echo __( 'Auth0 Dashboard', 'wp-auth0' ); ?></a> | ||
<?php echo __( ' and copy the Client ID and Client Secret.', 'wp-auth0' ); ?> | ||
<?php _e( 'There was an error creating the Auth0 App. Check the ', 'wp-auth0' ); ?> | ||
<a target="_blank" href="<?php echo admin_url( 'admin.php?page=wpa0-errors' ); ?>"><?php _e( 'error log', 'wp-auth0' ); ?></a> | ||
<?php _e( ' for more information. If the problem persists, please follow the ', 'wp-auth0' ); ?> | ||
<a target="_blank" href="https://auth0.com/docs/cms/wordpress/installation#manual-setup"><?php _e( 'manual setup instructions', 'wp-auth0' ); ?></a>. | ||
</strong> | ||
</p> | ||
</div> | ||
|
@@ -123,21 +81,21 @@ public function cant_create_client_message() { | |
|
||
public function cant_create_client_grant_message() { | ||
?> | ||
<div id="message" class="error"> | ||
<div class="notice notice-error"> | ||
<p> | ||
<strong> | ||
<?php echo __( 'There was an error creating the necessary client grants. ', 'wp-auth0' ); ?> | ||
<?php _e( 'There was an error creating the necessary client grants. ', 'wp-auth0' ); ?> | ||
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.
|
||
<?php | ||
echo __( | ||
_e( | ||
'Go to your Auth0 dashboard > APIs > Auth0 Management API > Machine to Machine Applications tab and authorize this Application. ', | ||
'wp-auth0' | ||
); | ||
?> | ||
<?php echo __( 'Make sure to add the following scopes: ', 'wp-auth0' ); ?> | ||
<?php _e( 'Make sure to add the following scopes: ', 'wp-auth0' ); ?> | ||
<code><?php echo implode( '</code>, <code>', WP_Auth0_Api_Client::get_required_scopes() ); ?></code> | ||
<?php echo __( 'You can also check the ', 'wp-auth0' ); ?> | ||
<a target="_blank" href="<?php echo admin_url( 'admin.php?page=wpa0-errors' ); ?>"><?php echo __( 'Error log', 'wp-auth0' ); ?></a> | ||
<?php echo __( ' for more information.', 'wp-auth0' ); ?> | ||
<?php _e( 'You can also check the ', 'wp-auth0' ); ?> | ||
<a target="_blank" href="<?php echo admin_url( 'admin.php?page=wpa0-errors' ); ?>"><?php _e( 'Error log', 'wp-auth0' ); ?></a> | ||
<?php _e( ' for more information.', 'wp-auth0' ); ?> | ||
</strong> | ||
</p> | ||
</div> | ||
|
@@ -146,13 +104,13 @@ public function cant_create_client_grant_message() { | |
|
||
public function cant_exchange_token_message() { | ||
?> | ||
<div id="message" class="error"> | ||
<div class="notice notice-error"> | ||
<p> | ||
<strong> | ||
<?php echo __( 'There was an error retrieving your Auth0 credentials. Check the ', 'wp-auth0' ); ?> | ||
<a target="_blank" href="<?php echo admin_url( 'admin.php?page=wpa0-errors' ); ?>"><?php echo __( 'Error log', 'wp-auth0' ); ?></a> | ||
<?php echo __( ' for more information.', 'wp-auth0' ); ?> | ||
<?php echo __( 'Please check that your server has internet access and can reach ', 'wp-auth0' ); ?> | ||
<?php _e( 'There was an error retrieving your Auth0 credentials. Check the ', 'wp-auth0' ); ?> | ||
<a target="_blank" href="<?php echo admin_url( 'admin.php?page=wpa0-errors' ); ?>"><?php _e( 'Error log', 'wp-auth0' ); ?></a> | ||
<?php _e( ' for more information.', 'wp-auth0' ); ?> | ||
<?php _e( 'Please check that your server has internet access and can reach ', 'wp-auth0' ); ?> | ||
<code>https://<?php echo $this->a0_options->get( 'domain' ); ?></code> | ||
</strong> | ||
</p> | ||
|
@@ -162,45 +120,26 @@ public function cant_exchange_token_message() { | |
|
||
public function rejected_message() { | ||
?> | ||
<div id="message" class="error"> | ||
<div class="notice notice-error"> | ||
<p> | ||
<strong> | ||
<?php echo __( 'The required scoped were rejected.', 'wp-auth0' ); ?> | ||
<?php _e( 'The required scopes were rejected.', 'wp-auth0' ); ?> | ||
</strong> | ||
</p> | ||
</div> | ||
<?php | ||
} | ||
|
||
public function access_denied() { | ||
public function access_denied_message() { | ||
?> | ||
<div class="notice notice-error"> | ||
<p> | ||
<strong> | ||
<?php echo __( 'Please create your Auth0 account first at ', 'wp-auth0' ); ?> | ||
<?php _e( 'Please create your Auth0 account first at ', 'wp-auth0' ); ?> | ||
<a href="https://manage.auth0.com">https://manage.auth0.com</a> | ||
</strong> | ||
</p> | ||
</div> | ||
<?php | ||
} | ||
|
||
public function init_setup() { | ||
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. Moved to |
||
if ( ( ! isset( $_REQUEST['page'] ) ) || ( 'wpa0-setup' !== $_REQUEST['page'] ) || ( ! isset( $_REQUEST['callback'] ) ) ) { | ||
return; | ||
} | ||
|
||
if ( isset( $_REQUEST['error'] ) && 'rejected' == $_REQUEST['error'] ) { | ||
wp_redirect( admin_url( 'admin.php?page=wpa0-setup&error=rejected' ) ); | ||
exit; | ||
} | ||
|
||
if ( isset( $_REQUEST['error'] ) && 'access_denied' == $_REQUEST['error'] ) { | ||
wp_redirect( admin_url( 'admin.php?page=wpa0-setup&error=access_denied' ) ); | ||
exit; | ||
} | ||
|
||
$this->consent_step->callback(); | ||
} | ||
|
||
} |
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.
Added this command to check coverage, default one does not (to speed up the checks).