Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rschnekenbu committed Jul 26, 2023
1 parent e376243 commit 30a847f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/plugin-ext/src/main/browser/authentication-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { interfaces } from '@theia/core/shared/inversify';
import { AuthenticationExt, AuthenticationMain, MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc';
import { RPCProtocol } from '../../common/rpc-protocol';
import { MessageService } from '@theia/core/lib/common/message-service';
import { Dialog, StorageService } from '@theia/core/lib/browser';
import { ConfirmDialog, Dialog, StorageService } from '@theia/core/lib/browser';
import {
AuthenticationProvider,
AuthenticationService,
Expand Down Expand Up @@ -199,13 +199,18 @@ export class AuthenticationMainImpl implements AuthenticationMain {
}

protected async loginPrompt(providerName: string, extensionName: string, recreatingSession: boolean, detail?: string): Promise<boolean> {
let message = recreatingSession
const msg = document.createElement('span');
msg.textContent = recreatingSession
? nls.localizeByDefault("The extension '{0}' wants you to sign in again using {1}.", extensionName, providerName)
: nls.localizeByDefault("The extension '{0}' wants to sign in using {1}.", extensionName, providerName);

message = detail ? message + ' ' + detail : message;
const choice = await this.messageService.info(message, 'Allow', 'Cancel');
return choice === 'Allow';
if (detail) {
const detailElement = document.createElement('p');
detailElement.textContent = detail;
msg.appendChild(detailElement);
}

return !!await new ConfirmDialog({ title: '', msg, ok: 'Allow', cancel: Dialog.CANCEL }).open();
}

protected async isAccessAllowed(providerId: string, accountName: string, extensionId: string): Promise<boolean> {
Expand Down

0 comments on commit 30a847f

Please sign in to comment.