From 1ccf31ad7d14a6531e4a330ffa29f628f4879304 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Thu, 30 Jul 2020 23:51:47 +0200 Subject: [PATCH] Fix profile without proper name --- assets/scripts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/scripts.js b/assets/scripts.js index daa47ae..002875a 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -234,6 +234,7 @@ async function displayProfile(opts) { return; } let userData = keyData.user.user.userId; + let userName = keyData.userData.name ? userData.name : keyData.publicKey.users[i].userId.email; // Determine WKD or HKP link switch (opts.mode) { @@ -278,11 +279,11 @@ async function displayProfile(opts) { } // Fill in various data - document.body.querySelector('#profileName').innerHTML = userData.name; + document.body.querySelector('#profileName').innerHTML = userName; document.body.querySelector('#profileAvatar').style = ""; const profileHash = openpgp.util.str_to_hex(openpgp.util.Uint8Array_to_str(await openpgp.crypto.hash.md5(openpgp.util.str_to_Uint8Array(userData.email)))); document.body.querySelector('#profileAvatar').src = `https://www.gravatar.com/avatar/${profileHash}?s=128&d=mm`; - document.title = `${userData.name} - Keyoxide`; + document.title = `${userName} - Keyoxide`; // Generate feedback feedback += `
`;