From 6c110bb9a4792036cf34c5355d615945c50c8742 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 3 Jul 2019 10:37:13 -0400 Subject: [PATCH] workaround for u2f bug in firefox on w10 --- src/_locales/en/messages.json | 3 +++ src/popup/accounts/two-factor.component.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index b49e0e4969a..d3941b99b02 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -912,6 +912,9 @@ "popup2faCloseMessage": { "message": "Clicking outside the popup window to check your email for your verification code will cause this popup to close. Do you want to open this popup in a new window so that it does not close?" }, + "popupU2fCloseMessage": { + "message": "This browser cannot process U2F requests in this popup window. Do you want to open this popup in a new window so that you can log in using U2F?" + }, "disableFavicon": { "message": "Disable Website Icons" }, diff --git a/src/popup/accounts/two-factor.component.ts b/src/popup/accounts/two-factor.component.ts index 8abab799466..df43cfe7ef1 100644 --- a/src/popup/accounts/two-factor.component.ts +++ b/src/popup/accounts/two-factor.component.ts @@ -66,8 +66,15 @@ export class TwoFactorComponent extends BaseTwoFactorComponent { }); }); + 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) { @@ -83,6 +90,15 @@ export class TwoFactorComponent extends BaseTwoFactorComponent { } } + if (!this.initU2f && this.selectedProviderType === TwoFactorProviderType.U2f && + this.popupUtilsService.inPopup(window)) { + const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('popupU2fCloseMessage'), + null, this.i18nService.t('yes'), this.i18nService.t('no')); + if (confirmed) { + this.popupUtilsService.popOut(window); + } + } + const isDuo = this.selectedProviderType === TwoFactorProviderType.Duo || this.selectedProviderType === TwoFactorProviderType.OrganizationDuo; if (!isSafari || !isDuo) {