mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
safari 2fa page cleanup
This commit is contained in:
@@ -6,8 +6,6 @@ import {
|
||||
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { BrowserApi } from '../../browser/browserApi';
|
||||
|
||||
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType';
|
||||
|
||||
import { ApiService } from 'jslib/abstractions/api.service';
|
||||
@@ -50,42 +48,19 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
/*
|
||||
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
|
||||
this.ngZone.run(async () => {
|
||||
switch (message.command) {
|
||||
case '2faPageResponse':
|
||||
if (message.type === 'duo') {
|
||||
this.token = message.data.sigValue;
|
||||
this.submitWithTab(message.webExtSender.tab);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
this.changeDetectorRef.detectChanges();
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
const isFirefox = this.platformUtilsService.isFirefox();
|
||||
if (this.popupUtilsService.inPopup(window) && isFirefox &&
|
||||
this.win.navigator.userAgent.indexOf('Windows NT 10.0;') > -1) {
|
||||
// ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1562620
|
||||
this.initU2f = false;
|
||||
}
|
||||
/*
|
||||
const isSafari = this.platformUtilsService.isSafari();
|
||||
this.showNewWindowMessage = isSafari;
|
||||
*/
|
||||
|
||||
await super.ngOnInit();
|
||||
|
||||
if (this.selectedProviderType == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (/*!isSafari && */this.selectedProviderType === TwoFactorProviderType.Email &&
|
||||
if (!isSafari && this.selectedProviderType === TwoFactorProviderType.Email &&
|
||||
this.popupUtilsService.inPopup(window)) {
|
||||
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('popup2faCloseMessage'),
|
||||
null, this.i18nService.t('yes'), this.i18nService.t('no'));
|
||||
@@ -102,28 +77,6 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
||||
this.popupUtilsService.popOut(window);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
const isDuo = this.selectedProviderType === TwoFactorProviderType.Duo ||
|
||||
this.selectedProviderType === TwoFactorProviderType.OrganizationDuo;
|
||||
if (!isSafari || !isDuo) {
|
||||
return;
|
||||
}
|
||||
|
||||
const params = this.authService.twoFactorProvidersData.get(this.selectedProviderType);
|
||||
const tab = BrowserApi.createNewTab(BrowserApi.getAssetUrl('2fa/index.html'));
|
||||
const tabToSend = BrowserApi.makeTabObject(tab);
|
||||
window.setTimeout(() => {
|
||||
BrowserApi.tabSendMessage(tabToSend, {
|
||||
command: '2faPageData',
|
||||
data: {
|
||||
type: 'duo',
|
||||
host: params.Host,
|
||||
signature: params.Signature,
|
||||
},
|
||||
});
|
||||
}, 500);
|
||||
*/
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
@@ -134,16 +87,4 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
||||
anotherMethod() {
|
||||
this.router.navigate(['2fa-options']);
|
||||
}
|
||||
|
||||
async submitWithTab(sendSuccessToTab: any) {
|
||||
await super.submit();
|
||||
if (sendSuccessToTab != null) {
|
||||
window.setTimeout(() => {
|
||||
BrowserApi.tabSendMessage(sendSuccessToTab, {
|
||||
command: '2faPageData',
|
||||
data: { type: 'success' },
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user