Don't panic in auth flow (#49916)
Closes #49641 Before you mark this PR as ready for review, make sure that you have: - [ ] Added a solid test coverage and/or screenshots from doing manual testing - [ ] Done a self-review taking into account security and performance aspects - [ ] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - Fixed panic when authentication failed to bind to lookback port
This commit is contained in:
1 parent
00250b90c6
commit
bc85d93c23
1 file changed
+4
-4
@@ -1369,9 +1369,9 @@ impl Client {
|
||||
// zed server to encrypt the user's access token, so that it can'be intercepted by
|
||||
// any other app running on the user's device.
|
||||
let (public_key, private_key) =
|
||||
rpc::auth::keypair().expect("failed to generate keypair for auth");
|
||||
rpc::auth::keypair().context("failed to generate keypair for auth")?;
|
||||
let public_key_string = String::try_from(public_key)
|
||||
.expect("failed to serialize public key for auth");
|
||||
.context("failed to serialize public key for auth")?;
|
||||
|
||||
if let Some((login, token)) =
|
||||
IMPERSONATE_LOGIN.as_ref().zip(ADMIN_API_TOKEN.as_ref())
|
||||
@@ -1386,8 +1386,8 @@ impl Client {
|
||||
}
|
||||
|
||||
// Start an HTTP server to receive the redirect from Zed's sign-in page.
|
||||
let server =
|
||||
tiny_http::Server::http("127.0.0.1:0").expect("failed to find open port");
|
||||
let server = tiny_http::Server::http("127.0.0.1:0")
|
||||
.map_err(|e| anyhow!(e).context("failed to bind callback port"))?;
|
||||
let port = server.server_addr().port();
|
||||
|
||||
// Open the Zed sign-in page in the user's browser, with query parameters that indicate
|
||||
|
||||
Reference in new issue
Block a user