Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 12 additions & 23 deletions src/index_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down