From 08ab0afdb029eab6c7ecf330a65a5421f42e766f Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 3 May 2021 14:04:33 -0500 Subject: [PATCH] Revert old logout code This reverts commit 947dd8561bfd211400d9ed0ab92490b570d37018, reversing changes made to 24dc2080f963e2abe833f466e5a74a9c69c79c25. --- lib/vscode/src/vs/server/common/cookie.ts | 3 -- .../browser/parts/titlebar/menubarControl.ts | 29 ++----------------- 2 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 lib/vscode/src/vs/server/common/cookie.ts diff --git a/lib/vscode/src/vs/server/common/cookie.ts b/lib/vscode/src/vs/server/common/cookie.ts deleted file mode 100644 index e2720a04..00000000 --- a/lib/vscode/src/vs/server/common/cookie.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum Cookie { - Key = 'key', -} diff --git a/lib/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/lib/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 397211f0..bc20eca2 100644 --- a/lib/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/lib/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -9,7 +9,7 @@ import { registerThemingParticipant, IThemeService } from 'vs/platform/theme/com import { MenuBarVisibility, getTitleBarStyle, IWindowOpenable, getMenuBarVisibility } from 'vs/platform/windows/common/windows'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IAction, Action, SubmenuAction, Separator } from 'vs/base/common/actions'; -import { addDisposableListener, Dimension, EventType, getCookieValue } from 'vs/base/browser/dom'; +import { addDisposableListener, Dimension, EventType } from 'vs/base/browser/dom'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { isMacintosh, isWeb, isIOS, isNative } from 'vs/base/common/platform'; import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; @@ -38,8 +38,6 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { ILogService } from 'vs/platform/log/common/log'; -import { Cookie } from 'vs/server/common/cookie'; export type IOpenRecentAction = IAction & { uri: URI, remoteAuthority?: string }; @@ -318,8 +316,7 @@ export class CustomMenubarControl extends MenubarControl { @IThemeService private readonly themeService: IThemeService, @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, @IHostService protected readonly hostService: IHostService, - @ICommandService commandService: ICommandService, - @ILogService private readonly logService: ILogService + @ICommandService commandService: ICommandService ) { super(menuService, workspacesService, contextKeyService, keybindingService, configurationService, labelService, updateService, storageService, notificationService, preferencesService, environmentService, accessibilityService, hostService, commandService); @@ -721,28 +718,6 @@ export class CustomMenubarControl extends MenubarControl { webNavigationActions.pop(); } - webNavigationActions.push(new Action('logout', localize('logout', "Log out"), undefined, true, - async (event?: MouseEvent) => { - const COOKIE_KEY = Cookie.Key; - const loginCookie = getCookieValue(COOKIE_KEY); - - this.logService.info('Logging out of code-server'); - - if(loginCookie) { - this.logService.info(`Removing cookie under ${COOKIE_KEY}`); - - if (document && document.cookie) { - // We delete the cookie by setting the expiration to a date/time in the past - document.cookie = COOKIE_KEY +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; - window.location.href = '/login'; - } else { - this.logService.warn('Could not delete cookie because document and/or document.cookie is undefined'); - } - } else { - this.logService.warn('Could not log out because we could not find cookie'); - } - })); - return webNavigationActions; }