Skip to content

Commit fa1291f

Browse files
committed
More ui friendly register flow2
1 parent 3fd2da9 commit fa1291f

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

src/cmd/auth.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ pub async fn run_auth(reset: bool, auth_provider: &str) -> Result<()> {
133133
);
134134
println!(" {}\n", auth_url.as_str().underlined().cyan());
135135

136+
let mut browser_failed = false;
137+
136138
if webbrowser::open(&auth_url).is_err() {
139+
browser_failed = true;
137140
println!(
138141
" {} Could not open browser automatically — please copy the link above.",
139142
"!".yellow().bold()
@@ -156,15 +159,24 @@ pub async fn run_auth(reset: bool, auth_provider: &str) -> Result<()> {
156159
save_config(&config)?;
157160

158161
let config_path = get_config_path()?.display().to_string();
159-
println!(
160-
" {} Authentication initiated! CLI ID saved to {}",
161-
"✓".green().bold(),
162-
config_path.underlined()
163-
);
164-
println!(
165-
" {} You can now use commands that require authentication.\n",
166-
"●".cyan()
167-
);
162+
163+
if !browser_failed {
164+
println!(
165+
" {} Authentication initiated! CLI ID saved to {}",
166+
"✓".green().bold(),
167+
config_path.underlined()
168+
);
169+
170+
println!(
171+
" {} You can now use commands that require authentication.\n",
172+
"●".cyan()
173+
);
174+
} else {
175+
println!(
176+
"{} You need to open the browser URL above to complete the authentication. After that, you can use the CLI as normal.",
177+
"?".yellow().bold(),
178+
);
179+
}
168180

169181
Ok(())
170182
}

0 commit comments

Comments
 (0)