From 856e7364264ef3335d3dca5e777a9fd1d73d3cdd Mon Sep 17 00:00:00 2001 From: Edgard Lorraine Messias Date: Tue, 3 Mar 2020 11:18:21 -0300 Subject: [PATCH] fix: Fixed no ask for username and password (close #849) (#850) --- src/repository.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/repository.ts b/src/repository.ts index 680627ee..82287e28 100644 --- a/src/repository.ts +++ b/src/repository.ts @@ -941,16 +941,25 @@ export class Repository implements IRemoteRepository { if (this.lastPromptAuth) { await this.lastPromptAuth; } - return keytar.findCredentials(this.getCredentialServiceName()); + + try { + return keytar.findCredentials(this.getCredentialServiceName()); + } catch (error) { + return []; + } } public async saveAuth(): Promise { if (this.canSaveAuth && this.username && this.password) { - await keytar.setPassword( - this.getCredentialServiceName(), - this.username, - this.password - ); + try { + await keytar.setPassword( + this.getCredentialServiceName(), + this.username, + this.password + ); + } catch (error) { + console.log(error); + } this.canSaveAuth = false; } }