From cf7a9e3d36644f6c02cee754d63604e191b9b648 Mon Sep 17 00:00:00 2001 From: benjamin538 Date: Sat, 7 Mar 2026 18:33:13 +0500 Subject: [PATCH] replace ask_value with ask_confirm --- src/index_auth.rs | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/index_auth.rs b/src/index_auth.rs index 85326f0..fc5b7df 100644 --- a/src/index_auth.rs +++ b/src/index_auth.rs @@ -139,29 +139,18 @@ pub fn invalidate(config: &mut Config) { warn!("You are not logged in"); return; } - loop { - let response = ask_value( - "Do you want to log out of all devices (y/n)", - Some("n"), - true, - ); - - match response.to_lowercase().as_str() { - "y" => { - invalidate_index_tokens(config); - config.index_token = None; - config.save(); - done!("All tokens for the current account have been invalidated successfully"); - break; - } - "n" => { - done!("Operation cancelled"); - break; - } - _ => { - warn!("Invalid response"); - } - } + let response = ask_confirm( + "Do you want to log out of all devices?", + false + ); + + if response { + invalidate_index_tokens(config); + config.index_token = None; + config.save(); + done!("All tokens for the current account have been invalidated successfully"); + } else { + done!("Operation canceled"); } }