diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-11 16:27:35 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-11 16:27:35 +0200 |
| commit | 5a4c4b9fa0df891fcdd9beee18be0db4a45da701 (patch) | |
| tree | b467a1bd5706643b77962e7a82d651a803bfc436 /crates/turtle/src/command/client/account | |
| parent | chore(server): Simplify the database support (diff) | |
| download | atuin-5a4c4b9fa0df891fcdd9beee18be0db4a45da701.zip | |
chore(server): Remove the last remnants of the "hub" sync-server thingy
Diffstat (limited to 'crates/turtle/src/command/client/account')
| -rw-r--r-- | crates/turtle/src/command/client/account/change_password.rs | 22 | ||||
| -rw-r--r-- | crates/turtle/src/command/client/account/delete.rs | 22 | ||||
| -rw-r--r-- | crates/turtle/src/command/client/account/login.rs | 15 |
3 files changed, 15 insertions, 44 deletions
diff --git a/crates/turtle/src/command/client/account/change_password.rs b/crates/turtle/src/command/client/account/change_password.rs index f7f7eb69..b23f518d 100644 --- a/crates/turtle/src/command/client/account/change_password.rs +++ b/crates/turtle/src/command/client/account/change_password.rs @@ -1,10 +1,7 @@ use clap::Parser; use eyre::{Result, bail}; -use crate::atuin_client::{ - auth::{self, MutateResponse}, - settings::Settings, -}; +use crate::atuin_client::{auth, settings::Settings}; use rpassword::prompt_password; #[derive(Parser, Debug)] @@ -45,20 +42,11 @@ impl Cmd { bail!("please provide a new password"); } - let mut totp_code = self.totp_code.clone(); + let totp_code = self.totp_code.clone(); - loop { - let response = client - .change_password(¤t_password, &new_password, totp_code.as_deref()) - .await?; - - match response { - MutateResponse::Success => break, - MutateResponse::TwoFactorRequired => { - totp_code = Some(super::login::or_user_input(None, "two-factor code")); - } - } - } + client + .change_password(¤t_password, &new_password, totp_code.as_deref()) + .await?; println!("Account password successfully changed!"); diff --git a/crates/turtle/src/command/client/account/delete.rs b/crates/turtle/src/command/client/account/delete.rs index 1c96cb4a..722c39ec 100644 --- a/crates/turtle/src/command/client/account/delete.rs +++ b/crates/turtle/src/command/client/account/delete.rs @@ -1,11 +1,8 @@ -use crate::atuin_client::{ - auth::{self, MutateResponse}, - settings::Settings, -}; +use crate::atuin_client::{auth, settings::Settings}; use clap::Parser; use eyre::{Result, bail}; -use super::login::{or_user_input, read_user_password}; +use super::login::read_user_password; #[derive(Parser, Debug)] pub(crate) struct Cmd { @@ -33,18 +30,9 @@ impl Cmd { let mut totp_code = self.totp_code.clone(); - loop { - let response = client - .delete_account(&password, totp_code.as_deref()) - .await?; - - match response { - MutateResponse::Success => break, - MutateResponse::TwoFactorRequired => { - totp_code = Some(or_user_input(None, "two-factor code")); - } - } - } + client + .delete_account(&password, totp_code.as_deref()) + .await?; // Clean up sessions from meta store let meta = Settings::meta_store().await?; diff --git a/crates/turtle/src/command/client/account/login.rs b/crates/turtle/src/command/client/account/login.rs index 1ec0293a..e9513879 100644 --- a/crates/turtle/src/command/client/account/login.rs +++ b/crates/turtle/src/command/client/account/login.rs @@ -5,7 +5,7 @@ use eyre::{Context, Result, bail}; use tokio::{fs::File, io::AsyncWriteExt}; use crate::atuin_client::{ - auth::{self, AuthResponse}, + auth, encryption::{decode_key, load_key}, record::sqlite_store::SqliteStore, record::store::Store, @@ -67,15 +67,10 @@ impl Cmd { let client = auth::auth_client(settings).await; let response = client.login(&username, &password).await?; - match response { - AuthResponse::Success { session, .. } => { - Settings::meta_store().await?.save_session(&session).await?; - } - AuthResponse::TwoFactorRequired => { - // Legacy server doesn't support 2FA, so this shouldn't happen. - bail!("unexpected two-factor requirement from legacy server"); - } - } + Settings::meta_store() + .await? + .save_session(&response.session) + .await?; println!("Logged in!"); Ok(()) |
