Skip to content

Commit

Permalink
Authentication Plugin API fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vinokurig committed Nov 6, 2020
1 parent d660747 commit b523c07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/browser/authentication-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class AuthenticationServiceImpl implements AuthenticationService {
if (e.event.added.length > 0) {
const sessions = await this.getSessions(e.providerId);
sessions.forEach(session => {
if (disposableMap.get(session.id)) {
if (sessions.find(s => disposableMap.get(s.id))) {
return;
}
const disposables = new DisposableCollection();
Expand Down Expand Up @@ -280,7 +280,7 @@ export class AuthenticationServiceImpl implements AuthenticationService {
const scopesList = scopes.sort().join('');
const extensionHasExistingRequest = providerRequests
&& providerRequests[scopesList]
&& providerRequests[scopesList].requestingExtensionIds.indexOf(extensionId) > 0;
&& providerRequests[scopesList].requestingExtensionIds.indexOf(extensionId) > -1;

if (extensionHasExistingRequest) {
return;
Expand Down
5 changes: 2 additions & 3 deletions packages/plugin-ext/src/main/browser/authentication-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,8 @@ export class AuthenticationProviderImpl implements AuthenticationProvider {
async signOut(accountName: string): Promise<void> {
const accountUsages = await readAccountUsages(this.storageService, this.id, accountName);
const sessionsForAccount = this.accounts.get(accountName);

const result = await this.messageService.info(`The account ${accountName} has been used by:
${accountUsages.map(usage => usage.extensionName).join(', ')}. Sign out of these features?`, 'Yes');
const result = await this.messageService.info(accountUsages.length ? `The account ${accountName} has been used by:
${accountUsages.map(usage => usage.extensionName).join(', ')}. Sign out of these features?` : `Sign out of ${accountName}?`, 'Yes');

if (result && result === 'Yes' && sessionsForAccount) {
sessionsForAccount.forEach(sessionId => this.logout(sessionId));
Expand Down

0 comments on commit b523c07

Please sign in to comment.