Clear credentials state and delete keychain on SignOut request (#10558)
Release Notes: - Fixed ([#4716](https://github.com/zed-industries/zed/issues/4716)). --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
c4e446f8a8
commit
c81eb419d4
1 changed files with 10 additions and 1 deletions
|
@ -132,7 +132,7 @@ pub fn init(client: &Arc<Client>, cx: &mut AppContext) {
|
|||
move |_: &SignOut, cx| {
|
||||
if let Some(client) = client.upgrade() {
|
||||
cx.spawn(|cx| async move {
|
||||
client.disconnect(&cx);
|
||||
client.sign_out(&cx).await;
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
@ -1250,6 +1250,15 @@ impl Client {
|
|||
})
|
||||
}
|
||||
|
||||
pub async fn sign_out(self: &Arc<Self>, cx: &AsyncAppContext) {
|
||||
self.state.write().credentials = None;
|
||||
self.disconnect(&cx);
|
||||
|
||||
if self.has_keychain_credentials(cx).await {
|
||||
delete_credentials_from_keychain(cx).await.log_err();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn disconnect(self: &Arc<Self>, cx: &AsyncAppContext) {
|
||||
self.peer.teardown();
|
||||
self.set_status(Status::SignedOut, cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue