From 1204fb93c24737548aded9bc2caccc5f56fb6523 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 22 Apr 2019 16:37:56 -0700 Subject: [PATCH] Fixed WebAuth key addition --- meshuser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshuser.js b/meshuser.js index 95530a3d..cee03759 100644 --- a/meshuser.js +++ b/meshuser.js @@ -2213,7 +2213,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use parent.f2l.attestationResult(clientAttestationResponse, attestationExpectations).then(function (regResult) { // Since we are registering a WebAuthn/FIDO2 key, remove all U2F keys (Type 1). var otphkeys2 = []; - for (var i = 0; i < user.otphkeys.length; i++) { if (user.otphkeys[i].type != 1) { otphkeys2.push(user.otphkeys[i]); } } + if (user.otphkeys && Array.isArray(user.otphkeys)) { for (var i = 0; i < user.otphkeys.length; i++) { if (user.otphkeys[i].type != 1) { otphkeys2.push(user.otphkeys[i]); } } } user.otphkeys = otphkeys2; // Add the new WebAuthn/FIDO2 keys