mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-13 00:51:45 +01:00
safari 2fa page cleanup
This commit is contained in:
parent
46bca30f04
commit
0e798c610e
@ -29,8 +29,7 @@ const filters = {
|
|||||||
],
|
],
|
||||||
safari: [
|
safari: [
|
||||||
'!build/safari/**/*',
|
'!build/safari/**/*',
|
||||||
'!build/downloader/**/*',
|
'!build/downloader/**/*'
|
||||||
'!build/2fa/**/*'
|
|
||||||
],
|
],
|
||||||
webExt: [
|
webExt: [
|
||||||
'!build/manifest.json'
|
'!build/manifest.json'
|
||||||
|
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit 2ab6b9f330144ef028c85ca3bbe210a28d012383
|
Subproject commit 94a12f76448fd21cb10b9eb2c5ff8086f043baf0
|
@ -1,50 +0,0 @@
|
|||||||
import * as DuoWebSDK from 'duo_web_sdk';
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
const isSafari = (typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 &&
|
|
||||||
navigator.userAgent.indexOf('Chrome') === -1;
|
|
||||||
|
|
||||||
if (!isSafari) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
safari.self.addEventListener('message', (msgEvent: any) => {
|
|
||||||
init2fa(JSON.parse(msgEvent.message.msg));
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
function init2fa(msg: any) {
|
|
||||||
if (msg.command !== '2faPageData' || !msg.data) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (msg.data.type === 'duo') {
|
|
||||||
DuoWebSDK.init({
|
|
||||||
iframe: undefined,
|
|
||||||
host: msg.data.host,
|
|
||||||
sig_request: msg.data.signature,
|
|
||||||
submit_callback: (theForm: Document) => {
|
|
||||||
const sigElement = theForm.querySelector('input[name="sig_response"]') as HTMLInputElement;
|
|
||||||
if (sigElement) {
|
|
||||||
safari.extension.dispatchMessage('bitwarden', {
|
|
||||||
command: '2faPageResponse',
|
|
||||||
type: 'duo',
|
|
||||||
data: {
|
|
||||||
sigValue: sigElement.value,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else if (msg.data.type === 'success') {
|
|
||||||
safari.extension.dispatchMessage('bitwarden', {
|
|
||||||
command: 'openPopup',
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
window.close();
|
|
||||||
}, 500);
|
|
||||||
} else {
|
|
||||||
// TODO: others like u2f?
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,31 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Two-step Login</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<style>
|
|
||||||
html, body {
|
|
||||||
height: 90%;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.frameWrapper {
|
|
||||||
background: url('../popup/images/loading.svg') 0 0 no-repeat;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin-bottom: -10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.frameWrapper iframe {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="frameWrapper">
|
|
||||||
<iframe id="duo_iframe"></iframe>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1102,9 +1102,6 @@
|
|||||||
"message": "Clear",
|
"message": "Clear",
|
||||||
"description": "To clear something out. example: To clear browser history."
|
"description": "To clear something out. example: To clear browser history."
|
||||||
},
|
},
|
||||||
"twoStepNewWindowMessage": {
|
|
||||||
"message": "Complete your two-step login request using the new tab."
|
|
||||||
},
|
|
||||||
"checkPassword": {
|
"checkPassword": {
|
||||||
"message": "Check if password has been exposed."
|
"message": "Check if password has been exposed."
|
||||||
},
|
},
|
||||||
|
@ -78,8 +78,7 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="selectedProviderType === providerType.Duo ||
|
<ng-container *ngIf="selectedProviderType === providerType.Duo ||
|
||||||
selectedProviderType === providerType.OrganizationDuo">
|
selectedProviderType === providerType.OrganizationDuo">
|
||||||
<div id="duo-frame" *ngIf="!showNewWindowMessage"><iframe id="duo_iframe"></iframe></div>
|
<div id="duo-frame"><iframe id="duo_iframe"></iframe></div>
|
||||||
<div *ngIf="showNewWindowMessage" class="content text-center">{{'twoStepNewWindowMessage' | i18n}}</div>
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<div class="box-content-row box-content-row-checkbox" appBoxRow>
|
<div class="box-content-row box-content-row-checkbox" appBoxRow>
|
||||||
|
@ -6,8 +6,6 @@ import {
|
|||||||
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { BrowserApi } from '../../browser/browserApi';
|
|
||||||
|
|
||||||
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType';
|
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType';
|
||||||
|
|
||||||
import { ApiService } from 'jslib/abstractions/api.service';
|
import { ApiService } from 'jslib/abstractions/api.service';
|
||||||
@ -50,42 +48,19 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
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();
|
const isFirefox = this.platformUtilsService.isFirefox();
|
||||||
if (this.popupUtilsService.inPopup(window) && isFirefox &&
|
if (this.popupUtilsService.inPopup(window) && isFirefox &&
|
||||||
this.win.navigator.userAgent.indexOf('Windows NT 10.0;') > -1) {
|
this.win.navigator.userAgent.indexOf('Windows NT 10.0;') > -1) {
|
||||||
// ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1562620
|
// ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1562620
|
||||||
this.initU2f = false;
|
this.initU2f = false;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
const isSafari = this.platformUtilsService.isSafari();
|
const isSafari = this.platformUtilsService.isSafari();
|
||||||
this.showNewWindowMessage = isSafari;
|
|
||||||
*/
|
|
||||||
|
|
||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
|
|
||||||
if (this.selectedProviderType == null) {
|
if (this.selectedProviderType == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/*!isSafari && */this.selectedProviderType === TwoFactorProviderType.Email &&
|
if (!isSafari && this.selectedProviderType === TwoFactorProviderType.Email &&
|
||||||
this.popupUtilsService.inPopup(window)) {
|
this.popupUtilsService.inPopup(window)) {
|
||||||
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('popup2faCloseMessage'),
|
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('popup2faCloseMessage'),
|
||||||
null, this.i18nService.t('yes'), this.i18nService.t('no'));
|
null, this.i18nService.t('yes'), this.i18nService.t('no'));
|
||||||
@ -102,28 +77,6 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
|||||||
this.popupUtilsService.popOut(window);
|
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() {
|
ngOnDestroy() {
|
||||||
@ -134,16 +87,4 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
|||||||
anotherMethod() {
|
anotherMethod() {
|
||||||
this.router.navigate(['2fa-options']);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ const RateUrls = {
|
|||||||
[DeviceType.VivaldiExtension]:
|
[DeviceType.VivaldiExtension]:
|
||||||
'https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews',
|
'https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews',
|
||||||
[DeviceType.SafariExtension]:
|
[DeviceType.SafariExtension]:
|
||||||
'https://itunes.apple.com/app/bitwarden-password-manager/id1137397744',
|
'https://apps.apple.com/app/bitwarden/id1352778147',
|
||||||
};
|
};
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -99,11 +99,6 @@ const plugins = [
|
|||||||
filename: 'downloader/index.html',
|
filename: 'downloader/index.html',
|
||||||
chunks: ['downloader/downloader'],
|
chunks: ['downloader/downloader'],
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: './src/2fa/index.html',
|
|
||||||
filename: '2fa/index.html',
|
|
||||||
chunks: ['2fa/2fa'],
|
|
||||||
}),
|
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin([
|
||||||
'./src/manifest.json',
|
'./src/manifest.json',
|
||||||
{ from: './src/_locales', to: '_locales' },
|
{ from: './src/_locales', to: '_locales' },
|
||||||
@ -154,7 +149,6 @@ const config = {
|
|||||||
'content/shortcuts': './src/content/shortcuts.ts',
|
'content/shortcuts': './src/content/shortcuts.ts',
|
||||||
'notification/bar': './src/notification/bar.js',
|
'notification/bar': './src/notification/bar.js',
|
||||||
'downloader/downloader': './src/downloader/downloader.ts',
|
'downloader/downloader': './src/downloader/downloader.ts',
|
||||||
'2fa/2fa': './src/2fa/2fa.ts',
|
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: false,
|
minimize: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user