diff --git a/src/users.js b/src/users.js index 7af286907..528879b70 100644 --- a/src/users.js +++ b/src/users.js @@ -563,7 +563,12 @@ function getOwner(callback) { } function inviteLink(user) { - return `${settings.adminOrigin()}/setupaccount.html?resetToken=${user.resetToken}&email=${encodeURIComponent(user.email)}` + (user.username ? `&username=${encodeURIComponent(user.username)}` : ''); + let link = `${settings.adminOrigin()}/setupaccount.html?resetToken=${user.resetToken}&email=${encodeURIComponent(user.email)}`; + + if (user.username) link += `&username=${encodeURIComponent(user.username)}`; + if (user.displayName) link += `&displayName=${encodeURIComponent(user.displayName)}`; + + return link; } function createInvite(userId, callback) {