trusted_devices_storage = $trusted_devices_storage; } /** * @param null|WP_Error|WP_User $user * * @return bool */ public function supports( $user ) { if ( ! $this->is_wp_user( $user ) ) { return false; } return $this->trusted_devices_storage->is_device_trusted( $user->ID ) && ! $this->login_support->has_final_response(); } /** * @param null|WP_Error|WP_User $user * * @return bool|JSON_Response|Redirection_Response|View_Response */ protected function handle( $user ) { $this->trusted_devices_storage->set_trusted_device_login_time( $user->ID ); try { $final_response = $this->json( array( 'user_id' => $this->get_user_id() ), 200 ); $this->login_support->set_final_response( $final_response ); } catch ( Exception $e ) { $this->capture_exception( $e ); } return $this->fallback( $user ); } }