1
0
mirror of https://github.com/bitwarden/web synced 2025-12-06 00:03:28 +00: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; u2fListening: boolean;
u2fResponse: string; u2fResponse: string;
masterPassword: string; masterPassword: string;
u2fScript: HTMLScriptElement;
authPromise: Promise<any>; authPromise: Promise<any>;
formPromise: Promise<any>; formPromise: Promise<any>;
private masterPasswordHash: string; private masterPasswordHash: string;
private closed = false;
private u2fScript: HTMLScriptElement;
constructor(private apiService: ApiService, private i18nService: I18nService, constructor(private apiService: ApiService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService, private analytics: Angulartics2, private toasterService: ToasterService,
@@ -55,6 +56,7 @@ export class TwoFactorU2fComponent implements OnInit, OnDestroy {
} }
ngOnDestroy() { ngOnDestroy() {
this.closed = true;
window.document.body.removeChild(this.u2fScript); window.document.body.removeChild(this.u2fScript);
} }
@@ -86,7 +88,7 @@ export class TwoFactorU2fComponent implements OnInit, OnDestroy {
} }
private readDevice() { private readDevice() {
if (this.enabled) { if (this.closed || this.enabled) {
return; return;
} }

View File

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

View File

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

View File

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