options_storage = $options_storage; } /** * @param null|WP_Error|WP_User $user * * @return bool */ public function supports( $user ) { if ( ! $this->is_wp_user( $user ) ) { return false; } try { $roles = $this->get_roles(); } catch ( User_Not_Found_Exception $e ) { return false; } return ! $this->user_storage->is_2fa_enabled() && ! $this->options_storage->has_twofas_role( $roles ); } /** * @param null|WP_Error|WP_User $user * * @return bool|JSON_Response|Redirection_Response|View_Response */ protected function handle( $user ) { return $this->json( array( 'user_id' => $user->ID ), 200 ); } }