Skip to content

Commit

Permalink
Remove enterprise setup option and clean up setup steps
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcanhelp committed Jan 25, 2020
1 parent b9099a4 commit e486862
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 359 deletions.
28 changes: 0 additions & 28 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,34 +163,6 @@ jQuery(document).ready(function($) {
}, 'json');
} );

/*
Initial setup
*/
$('.js-a0-setup-input').keydown(function(e){
// Do not submit the form if the enter key is pressed.
if(13 === e.keyCode) {
e.preventDefault();
return false;
}
});

$('.js-a0-select-setup').click(function (e) {
e.preventDefault();
$('#profile-type').val($(this).attr('data-profile-type'));
$('#connectionSelectedModal').modal();
});

$('#manuallySetToken').click(function (e) {
e.preventDefault();
$('#enterTokenModal').modal();
$('#connectionSelectedModal').modal('hide');
});

$('#automaticSetup').click(function (e) {
e.preventDefault();
$('#profile-form').submit();
});

/**
* Show a JS confirm box to give a chance to cancel an on-page action.
*
Expand Down
25 changes: 7 additions & 18 deletions lib/initial-setup/WP_Auth0_InitialSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ class WP_Auth0_InitialSetup {

protected $a0_options;
protected $connection_profile;
protected $enterprise_connection_step;
protected $adminuser_step;
protected $connections_step;
protected $end_step;

public function __construct( WP_Auth0_Options $a0_options ) {
$this->a0_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->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 );
$this->connection_profile = new WP_Auth0_InitialSetup_ConnectionProfile( $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 );
}

public function notify_error() {
Expand All @@ -25,8 +23,7 @@ public function notify_error() {

public function render_setup_page() {

$step = ( isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : 1 );
$profile = ( isset( $_REQUEST['profile'] ) ? $_REQUEST['profile'] : null );
$step = ( isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : 1 );

if ( is_numeric( $step ) && $step >= 1 && $step <= 6 ) {

Expand All @@ -42,19 +39,11 @@ public function render_setup_page() {
break;

case 2:
if ( $profile == 'social' ) {
$this->connections_step->render( $step );
} elseif ( $profile == 'enterprise' ) {
$this->enterprise_connection_step->render( $step );
}
$this->connections_step->render( $step );
break;

case 3:
if ( $profile == 'social' ) {
$this->adminuser_step->render( $step );
} elseif ( $profile == 'enterprise' ) {
// $this->connections_step->render($step);
}
$this->adminuser_step->render( $step );
break;

case 4:
Expand Down
2 changes: 1 addition & 1 deletion lib/initial-setup/WP_Auth0_InitialSetup_Consent.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function callback_with_token( $domain, $access_token, $type, $hasInternet
$this->state = $type;
$this->hasInternetConnection = $hasInternetConnection;

if ( ! in_array( $this->state, [ 'social', 'enterprise' ] ) ) {
if ( $this->state !== 'social' ) {
wp_redirect( admin_url( 'admin.php?page=wpa0-setup&error=invalid_state' ) );
exit;
}
Expand Down
80 changes: 0 additions & 80 deletions lib/initial-setup/WP_Auth0_InitialSetup_EnterpriseConnection.php

This file was deleted.

10 changes: 3 additions & 7 deletions templates/a0-error-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
$error_log = new WP_Auth0_ErrorLog();
$errors = $error_log->get();
?>
<div class="a0-wrap">
<div class="a0-wrap settings wrap">

<?php require WPA0_PLUGIN_DIR . 'templates/initial-setup/partials/header.php'; ?>

<div class="a0-table">
<h1><?php _e( 'Auth0 Error Log', 'wp-auth0' ); ?></h1>
<h1><?php _e( 'Error Log', 'wp-auth0' ); ?></h1>
<?php if ( ! empty( $errors ) ) : ?>
<div class="a0-buttons">
<form action="<?php echo admin_url( 'options.php' ); ?>" method="post" class="js-a0-confirm-submit"
Expand All @@ -26,9 +23,8 @@
</form>
</div>
<?php endif; ?>
</div>

<table class="a0-table widefat">
<table class="widefat top-margin">
<thead>
<tr>
<th><?php _e( 'Date', 'wp-auth0' ); ?></th>
Expand Down
2 changes: 0 additions & 2 deletions templates/import_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
?>
<div class="a0-wrap settings wrap">

<?php require WPA0_PLUGIN_DIR . 'templates/initial-setup/partials/header.php'; ?>

<div class="container-fluid">

<h1><?php _e( 'Import and Export Settings', 'wp-auth0' ); ?></h1>
Expand Down
9 changes: 2 additions & 7 deletions templates/initial-setup/admin-creation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
$error = isset( $_REQUEST['result'] ) && $_REQUEST['result'] === 'error';
$current_user = wp_get_current_user();
?>
<div class="a0-wrap">

<?php require WPA0_PLUGIN_DIR . 'templates/initial-setup/partials/header.php'; ?>
<?php require WPA0_PLUGIN_DIR . 'templates/initial-setup/partials/steps.php'; ?>
<div class="a0-wrap settings wrap">

<div class="container-fluid">
<div class="row">

<h1><?php _e( 'Choose your password', 'wp-auth0' ); ?></h1>
<h1><?php _e( 'Step 3:', 'wp-auth0' ); ?> <?php _e( 'Choose your password', 'wp-auth0' ); ?></h1>

<p class="a0-step-text"><?php _e( 'Last step: Auth0 will migrate your own account from the WordPress user database to Auth0. You can choose to use the same password as you currently use, or pick a new one. Either way, Auth0 will link your existing account and its administrative role with the new account in Auth0. Type the password you wish to use for this account below.', 'wp-auth0' ); ?></p>

Expand Down Expand Up @@ -42,6 +38,5 @@

</form>

</div>
</div>
</div>
Loading

0 comments on commit e486862

Please # to comment.