Skip to content

Commit

Permalink
Fixing user migration setting validation throwing errors. Fixes #374
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcanhelp committed Jan 30, 2018
1 parent bdd7891 commit aca803e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/admin/WP_Auth0_Admin_Advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,21 @@ public function migration_ws_validation( $old_options, $input ) {
if ( $old_options['migration_ws'] != $input['migration_ws'] ) {

if ( 1 == $input['migration_ws'] ) {
$secret = $input['client_secret_b64_encoded'] ? JWT::urlsafeB64Decode( $secret) : $input['client_secret'];

$token_id = uniqid();
$secret = $input['client_secret'];
if ( $input['client_secret_b64_encoded'] ) {
$secret = JWT::urlsafeB64Decode( $secret );
}

$input['migration_token'] = JWT::encode( array( 'scope' => 'migration_ws', 'jti' => $token_id ), $secret );
$input['migration_token_id'] = $token_id;

// if ($response === false) {
$error = __( 'There was an error enabling your custom database. Check how to do it manually ', 'wp-auth0' );
$error .= '<a href="https://manage.auth0.com/#/connections/database">HERE</a>.';
$this->add_validation_error( $error );
// }
$this->add_validation_error(
__( 'User Migration needs to be configured manually. ', 'wp-auth0' )
. __( 'Please see Advanced > Users Migration below for your token, instructions are ', 'wp-auth0' )
. '<a href="https://auth0.com/docs/users/migrations/automatic">HERE</a>.'
);

} else {
$input['migration_token'] = null;
Expand Down

0 comments on commit aca803e

Please sign in to comment.