Skip to content

Commit

Permalink
fix: Fixed no ask for username and password (close #849) (#850)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Mar 3, 2020
1 parent dc99bba commit 856e736
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
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;
}
}
Expand Down

0 comments on commit 856e736

Please sign in to comment.