1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-07-04 11:55:58 +02:00

u2d lib is externals

This commit is contained in:
Kyle Spearrin 2018-06-27 22:05:33 -04:00
parent bf5d8cab1c
commit 5760efdaa1
4 changed files with 9 additions and 3 deletions

View File

@ -35,12 +35,13 @@ export class TwoFactorU2fComponent implements OnInit, OnDestroy {
u2fListening: boolean;
u2fResponse: string;
masterPassword: string;
u2fScript: HTMLScriptElement;
authPromise: Promise<any>;
formPromise: Promise<any>;
private masterPasswordHash: string;
private closed = false;
private u2fScript: HTMLScriptElement;
constructor(private apiService: ApiService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService,
@ -55,6 +56,7 @@ export class TwoFactorU2fComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.closed = true;
window.document.body.removeChild(this.u2fScript);
}
@ -86,7 +88,7 @@ export class TwoFactorU2fComponent implements OnInit, OnDestroy {
}
private readDevice() {
if (this.enabled) {
if (this.closed || this.enabled) {
return;
}

View File

@ -4,6 +4,7 @@
<head>
<meta charset="utf-8" />
<title>Bitwarden U2F Connector</title>
<script src="../scripts/u2f.js"></script>
</head>
<body></body>

View File

@ -1,4 +1,4 @@
require('../scripts/u2f');
import * as u2f from 'u2f';
document.addEventListener('DOMContentLoaded', function (event) {
init();

View File

@ -147,6 +147,9 @@ const config = {
'connectors/u2f': './src/connectors/u2f.js',
'connectors/duo': './src/connectors/duo.ts',
},
externals: {
'u2f': 'u2f',
},
resolve: {
extensions: ['.ts', '.js'],
alias: {