in htdocs/js/boxer.js [114:260]
function show_page_profile(canvas, login) {
canvas.innerText = "";
init_step(canvas, 5);
let card = document.createElement('div');
card.setAttribute('id', "card");
let avatar = document.createElement('img');
avatar.setAttribute('src', `https://github.com/${login.github.login}.png`);
avatar.setAttribute('class', 'avatar');
card.appendChild(avatar);
let name = document.createElement('h1');
name.innerText = login.credentials.fullname;
card.appendChild(name);
card.appendChild(document.createElement('hr'));
let boxerstatus = document.createElement('table');
boxerstatus.style.border = "none";
boxerstatus.style.width = "95%"
// ASF Auth
if (login.credentials.uid) {
let tr = document.createElement('tr');
let icon = document.createElement('td');
icon.style.textAlign = 'center';
let iconimg = document.createElement('img');
iconimg.setAttribute('src', 'images/asf.png');
iconimg.style.height = '24px';
icon.appendChild(iconimg);
let xtxt = document.createElement('td');
xtxt.innerText = `Authenticated at ASF as: ${login.credentials.uid}`;
tr.appendChild(icon);
tr.appendChild(xtxt);
boxerstatus.appendChild(tr);
}
// GitHub Auth
if (login.github.login) {
let tr = document.createElement('tr');
let icon = document.createElement('td');
icon.style.textAlign = 'center';
let iconimg = document.createElement('img');
iconimg.setAttribute('src', 'images/github.png');
iconimg.style.height = '24px';
icon.appendChild(iconimg);
let xtxt = document.createElement('td');
xtxt.innerText = `Authenticated at GitHub as: ${login.github.login} `;
let unlink = document.createElement('a');
unlink.setAttribute('class',' unlink');
unlink.setAttribute('href', '#');
unlink.innerText = "unlink account";
unlink.addEventListener('click', unlink_github);
xtxt.appendChild(unlink);
tr.appendChild(icon);
tr.appendChild(xtxt);
boxerstatus.appendChild(tr);
}
card.appendChild(boxerstatus);
canvas.appendChild(card);
if (login.github.mfa) {
if (login.github.repositories.length > 0) {
let ul = document.createElement('ul');
ul.setAttribute('class', 'striped');
canvas.appendChild(ul);
ul.innerText = "You have write access to the following repositories:";
login.github.repositories.sort();
for (let i = 0; i < login.github.repositories.length; i++) {
let repo = login.github.repositories[i];
const ghlink = `https://github.com/${gh_org}/${repo}`;
let gblink = `https://gitbox.apache.org/repos/asf/${repo}.git`;
let private = false;
let archived = login.github.metadata[repo].archived;
if (login.github.private.includes(repo)) {
private = true;
let m = repo.match(/^(?:incubator-)?(empire-db|[^-.]+)-?.*/);
if (m) {
const project = m[1];
gblink = `https://gitbox.apache.org/repos/private/${project}/${repo}.git`;
}
}
const repospan = document.createElement('span');
repospan.style.display = "inline-block";
repospan.style.width = "480px";
repospan.innerText = repo + ".git";
repospan.style.color = private ? "red" : "black";
if (archived) {
repospan.style.color = "grey";
repospan.style.textDecoration = "line-through";
repospan.innerText += " (archived)";
}
const gha = document.createElement('a');
gha.style.marginLeft = "20px";
gha.setAttribute("href", ghlink);
gha.setAttribute("target", "_blank");
gha.innerText = "GitHub";
const gba = document.createElement('a');
gba.style.marginLeft = "20px";
gba.setAttribute("href", gblink);
gba.setAttribute("target", "_blank");
gba.innerText = "GitBox";
const visispan = document.createElement('span');
visispan.style.marginLeft = "20px";
visispan.style.width = "8rem";
visispan.style.display = "inline-block";
visispan.innerText = private ? "Private repository" : "Public repository";
visispan.style.color = private ? "red" : "black";
const desc = document.createElement('span');
desc.style.display = "inline-block";
desc.style.width = "520px";
desc.style.lineHeight = "100%";
desc.style.whiteSpace = "nowrap";
desc.style.textOverflow = "ellipsis";
desc.style.overflowX = "hidden";
desc.style.color = "grey";
desc.style.marginLeft = "12px";
desc.style.fontSize = "0.8rem";
desc.innerText = login.github.metadata[repo].description;
const li = document.createElement('li');
li.appendChild(repospan);
li.appendChild(gha);
li.appendChild(gba);
li.appendChild(visispan);
li.appendChild(desc);
ul.appendChild(li);
}
} else {
canvas.appendChild(document.createTextNode("You do not appear to have access to any git repositories right now.\nIf you just linked your accounts, please allow a few minutes for the system to register your new repository access list."));
}
} else {
canvas.appendChild(document.createTextNode("You need to enable multi-factor authentication at GitHub to get write access to repositories there."));
let a = document.createElement('a');
a.setAttribute('href', 'https://github.com/settings/security');
a.setAttribute('target', '_new');
a.innerText = "GitHub Account Security";
canvas.appendChild(document.createElement('br'));
canvas.appendChild(document.createTextNode("Please follow this link to set it up: "));
canvas.appendChild(a);
canvas.appendChild(document.createElement('br'));
canvas.appendChild(document.createTextNode("It may take up to five minutes for Boxer to recognize your MFA being enabled."));
}
}