Skip to content

Commit 856e736

Browse files
fix: Fixed no ask for username and password (close #849) (#850)
1 parent dc99bba commit 856e736

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/repository.ts

+15-6
Original file line numberDiff line numberDiff line change
@@ -941,16 +941,25 @@ export class Repository implements IRemoteRepository {
941941
if (this.lastPromptAuth) {
942942
await this.lastPromptAuth;
943943
}
944-
return keytar.findCredentials(this.getCredentialServiceName());
944+
945+
try {
946+
return keytar.findCredentials(this.getCredentialServiceName());
947+
} catch (error) {
948+
return [];
949+
}
945950
}
946951

947952
public async saveAuth(): Promise<void> {
948953
if (this.canSaveAuth && this.username && this.password) {
949-
await keytar.setPassword(
950-
this.getCredentialServiceName(),
951-
this.username,
952-
this.password
953-
);
954+
try {
955+
await keytar.setPassword(
956+
this.getCredentialServiceName(),
957+
this.username,
958+
this.password
959+
);
960+
} catch (error) {
961+
console.log(error);
962+
}
954963
this.canSaveAuth = false;
955964
}
956965
}

0 commit comments

Comments
 (0)