1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-24 16:49:26 +01:00

check event.data type. some debug logging

This commit is contained in:
Kyle Spearrin 2018-07-21 14:07:06 -04:00
parent 57ce9d5315
commit 7b89ad6bf7

View File

@ -47,6 +47,8 @@ export class U2f {
} }
private parseMessage(event: any) { private parseMessage(event: any) {
console.log('got u2f event');
console.log(event);
if (!this.validMessage(event)) { if (!this.validMessage(event)) {
this.errorCallback('Invalid message.'); this.errorCallback('Invalid message.');
return; return;
@ -63,8 +65,8 @@ export class U2f {
} }
private validMessage(event: any) { private validMessage(event: any) {
if (!event.origin || event.origin === '' || if (event.origin == null || event.origin === '' || event.origin !== (this.connectorLink as any).origin ||
event.origin !== (this.connectorLink as any).origin || !event.data) { event.data == null || typeof (event.data) !== 'string') {
return false; return false;
} }