diff options
| author | Michelle Tilley <michelle@michelletilley.net> | 2026-03-23 09:33:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-23 09:33:04 -0700 |
| commit | 7f06ba0ee93eebf4482a7eb5d5d25e9d8a072f9d (patch) | |
| tree | 20f214ce5d0ac08dc6eee0beb2c3c70128050a8e /crates/atuin-server | |
| parent | feat: hex init nu (#3330) (diff) | |
| download | atuin-7f06ba0ee93eebf4482a7eb5d5d25e9d8a072f9d.zip | |
chore: Refactor CLI auth flows and token storage (#3317)
This PR eplaces the binary `is_hub_sync()` auth routing with an explicit
`SyncAuth` enum that classifies the client's authentication state at
runtime. This fixes a class of bugs where CLI session tokens were
silently mis-stored or used with the wrong auth scheme during Hub
migration.
Diffstat (limited to 'crates/atuin-server')
| -rw-r--r-- | crates/atuin-server/src/handlers/user.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/atuin-server/src/handlers/user.rs b/crates/atuin-server/src/handlers/user.rs index 6436e327..dda7a381 100644 --- a/crates/atuin-server/src/handlers/user.rs +++ b/crates/atuin-server/src/handlers/user.rs @@ -150,7 +150,10 @@ pub async fn register<DB: Database>( counter!("atuin_users_registered").increment(1); match db.add_session(&new_session).await { - Ok(_) => Ok(Json(RegisterResponse { session: token })), + Ok(_) => Ok(Json(RegisterResponse { + session: token, + auth: Some("cli".into()), + })), Err(e) => { error!("failed to add session: {}", e); Err(ErrorResponse::reply("failed to register user") @@ -254,6 +257,7 @@ pub async fn login<DB: Database>( Ok(Json(LoginResponse { session: session.token, + auth: Some("cli".into()), })) } |
