diff --git a/changelog/fix-remove-unused-file b/changelog/fix-remove-unused-file new file mode 100644 index 00000000000..fb464b062ca --- /dev/null +++ b/changelog/fix-remove-unused-file @@ -0,0 +1,5 @@ +Significance: patch +Type: dev +Comment: Removed unused file. + + diff --git a/includes/admin/class-wc-rest-user-exists-controller.php b/includes/admin/class-wc-rest-user-exists-controller.php deleted file mode 100644 index bd9d1eeb6aa..00000000000 --- a/includes/admin/class-wc-rest-user-exists-controller.php +++ /dev/null @@ -1,89 +0,0 @@ -namespace, - '/' . $this->rest_base, - // Silence the nosemgrep audit rule because this controller (and its routes) is not being used. - // This file is only left to avoid plugin upgrade errors. - // See this issue for a permanent fix: https://github.com/Automattic/woocommerce-payments/issues/6304 - // nosemgrep: audit.php.wp.security.rest-route.permission-callback.return-true -- reason: this controller is not being used. - [ - 'methods' => WP_REST_Server::CREATABLE, - 'callback' => [ $this, 'user_exists' ], - 'permission_callback' => '__return_true', - 'args' => [ - 'email' => [ - 'required' => true, - 'description' => __( 'Email address.', 'woocommerce-payments' ), - 'type' => 'string', - 'format' => 'email', - ], - ], - ] - ); - } - - /** - * Retrieve if a user exists by email address. - * - * @param WP_REST_Request $request Full details about the request. - * - * @return WP_REST_Response - */ - public function user_exists( WP_REST_Request $request ): WP_REST_Response { - $email = $request->get_param( 'email' ); - $email_exists = ! empty( email_exists( $email ) ); - $message = null; - - if ( $email_exists ) { - // Use this function to show the core error message. - $error = wc_create_new_customer( $email ); - $message = $error->get_error_message(); - } - - return new WP_REST_Response( - [ - 'user-exists' => $email_exists, - 'message' => $message, - ] - ); - } -} -