@@ -485,17 +485,23 @@ public function migration_ws_validation( $old_options, $input ) {
485485 $ input ['migration_token ' ] = null ;
486486 $ input ['migration_token_id ' ] = null ;
487487
488- $ connection = WP_Auth0_Api_Client:: get_connection ( $ input [ ' domain ' ], $ input [ ' auth0_app_token ' ], $ old_options ['db_connection_id ' ]);
488+ if ( isset ( $ old_options ['db_connection_id ' ])) {
489489
490- $ connection ->options ->enabledDatabaseCustomization = false ;
491- $ connection ->options ->import_mode = false ;
492490
493- unset($ connection ->name );
494- unset($ connection ->strategy );
495- unset($ connection ->id );
491+ $ connection = WP_Auth0_Api_Client::get_connection ($ input ['domain ' ], $ input ['auth0_app_token ' ], $ old_options ['db_connection_id ' ]);
496492
497- $ response = WP_Auth0_Api_Client::update_connection ($ input ['domain ' ], $ input ['auth0_app_token ' ], $ old_options ['db_connection_id ' ], $ connection );
498-
493+ $ connection ->options ->enabledDatabaseCustomization = false ;
494+ $ connection ->options ->import_mode = false ;
495+
496+
497+ unset($ connection ->name );
498+ unset($ connection ->strategy );
499+ unset($ connection ->id );
500+
501+ $ response = WP_Auth0_Api_Client::update_connection ($ input ['domain ' ], $ input ['auth0_app_token ' ], $ old_options ['db_connection_id ' ], $ connection );
502+ } else {
503+ $ response = false ;
504+ }
499505
500506 if ( $ response === false ) {
501507 $ error = __ ( 'There was an error disabling your custom database. Check how to do it manually ' , WPA0_LANG );
@@ -568,7 +574,7 @@ public function connections_validation( $old_options, $input ) {
568574 $ matching = array_intersect ($ enabled_connections , $ check_if_enabled );
569575
570576 if (array_diff ($ matching , $ check_if_enabled ) !== array_diff ($ check_if_enabled , $ matching )) {
571- $ error = __ ( 'The passwordless connection is not enabled. Pleas go to the Auth0 Dashboard and configure it. ' , WPA0_LANG );
577+ $ error = __ ( 'The passwordless connection is not enabled. Please go to the Auth0 Dashboard and configure it. ' , WPA0_LANG );
572578 $ this ->add_validation_error ( $ error );
573579 }
574580
0 commit comments