Fixed WebAuth key addition

This commit is contained in:
Ylian Saint-Hilaire 2019-04-22 16:37:56 -07:00
parent ab9ea4e58a
commit 1204fb93c2

View File

@ -2213,7 +2213,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
parent.f2l.attestationResult(clientAttestationResponse, attestationExpectations).then(function (regResult) { parent.f2l.attestationResult(clientAttestationResponse, attestationExpectations).then(function (regResult) {
// Since we are registering a WebAuthn/FIDO2 key, remove all U2F keys (Type 1). // Since we are registering a WebAuthn/FIDO2 key, remove all U2F keys (Type 1).
var otphkeys2 = []; 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; user.otphkeys = otphkeys2;
// Add the new WebAuthn/FIDO2 keys // Add the new WebAuthn/FIDO2 keys