Getting started on the second part of ssh recovery

This commit is contained in:
evanc 2023-11-06 13:46:39 +00:00
parent 7ab4419132
commit db6c5aa2a3

View file

@ -1,86 +1,149 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Account Recovery</title>
<link href="../images/favicon/favicon-16x16.png" rel="icon" type="image/png"/>
<link href="../stylesheets/index.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="wrapper">
<header class="page-header">
<img alt="Sharky, our mascot" height="81.56" src="../images/sharky.svg" width="145"/>
<h1>Skynet Self Service</h1>
</header>
<main class="page-body">
<h1>SSH key recovery</h1>
<p>
Recover a legacy skynet account using your username and set a new email address to link to the account. Use this only if you do not remember the account password and the linked account email is lost or incorrect.<br> Enter skynet username & email you have used with UL Wolves. </br>
</p>
<html lang="en"><head>
<meta charset="UTF-8">
<title>Account Recovery</title>
<link href="../images/favicon/favicon-16x16.png" rel="icon" type="image/png">
<link href="../stylesheets/index.css" rel="stylesheet" type="text/css">
</head>
<body class="vsc-initialized">
<div class="wrapper">
<header class="page-header">
<img alt="Sharky, our mascot" height="81.56" src="../images/sharky.svg" width="145">
<h1>Skynet Self Service</h1>
</header>
<main class="page-body" id="sign" hidden="">
<h1>SSH key recovery</h1>
<p>In a terminal or windows command prompt run
<br><b><code>echo </code><b id="authcode"></b><code> | ssh-keygen -Y sign -n file -f /path/to/private/key
</code></b><br> <br>With one of the following keys
</p>
<p id="keys"></p><form id="form2">
<table id="table">
<tbody><tr>
<td><label for="user">Username</label></td>
<td><input id="user" name="user" type="text"> </td>
</tr>
<tr>
<td><label for="signed">Signed AuthCode</label></td>
<td><input id="signed" name="signed" type="text"> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="submit"></td>
</tr>
</tbody></table>
</form>
<form id="form">
<table id="table">
<tr>
<td><label for="user">Username</label></td>
<td><input id="user" name="user" type="text"/> <br/></td>
</tr>
<tr>
<td><label for="mail">Email</label></td>
<td><input id="mail" name="mail" type="email"/> <br/></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="submit"/></td>
</tr>
</table>
</form>
<p id="formStatus"></p>
<script>
const formEl = document.getElementById("form");
formEl.addEventListener('submit', formHandler);
<script>
const formE2 = document.getElementById("form2");
formE2.addEventListener('submit', formHandler);
function formHandler(listener) {
listener.preventDefault();
const formData = new FormData(formEl);
const object = {user: formData.get('user'), email: formData.get('mail')};
fetch('https://api.account.skynet.ie/ldap/recover/ssh/request', {
method: 'POST',
body: JSON.stringify(object),
mode: "cors"
})
.then(status)
.then(json)
.catch(() => {
document.getElementById('formStatus').innerHTML = "<span style='background-color: yellow; color: black'>Please try again</span>";
});
function formHandler(listener) {
listener.preventDefault();
const formData = new FormData(formE2);
const object = {user: formData.get('user'), auth_signed: formData.get('signed')};
fetch('https://api.account.skynet.ie/ldap/recover/ssh/verify', {
method: 'POST',
body: JSON.stringify(object),
mode: "cors"
})
.then(status)
.then(json)
.catch(() => {
document.getElementById('formStatus1').innerHTML = "<span style='background-color: yellow; color: black'>Please try again</span>";
});
}
function status(res) {
if (res.status === 200) {
return res.json();
} else if (res.status === 500) {
document.getElementById('formStatus1').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";
} else {
document.getElementById('formStatus1').innerHTML = "<span style='background-color: red; color: white'>Failure: Failed to communicate to server</span>";
}
}
function status(res) {
if (res.status === 200) {
return res.json();
} else if (res.status === 500) {
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";
function json(temp) {
if (temp) {
if (temp.result === 'error' ) {
document.getElementById('formStatus1').innerHTML = `<span style='background-color: red; color: white'>${temp.error}</span>`;
} else {
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Failed to communicate to server</span>";
document.getElementById('formStatus1').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
}
}
}
</script><p id="formStatus1"></p>
</main><main class="page-body" id="request">
<h1>SSH key recovery</h1>
<p>
Recover a legacy skynet account using your username and set a new email address to link to the account. Use this only if you do not remember the account password and the linked account email is lost or incorrect.<br> Enter skynet username &amp; email you have used with UL Wolves. <br>
</p>
<form id="form">
<table id="table">
<tbody><tr>
<td><label for="user">Username</label></td>
<td><input id="user" name="user" type="text"> <br></td>
</tr>
<tr>
<td><label for="mail">Email</label></td>
<td><input id="mail" name="mail" type="email"> <br></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="submit"></td>
</tr>
</tbody></table>
</form>
<p id="formStatus"><span style="background-color: green; color: white">Success</span></p>
<script>
const formEl = document.getElementById("form");
formEl.addEventListener('submit', formHandler);
function formHandler(listener) {
listener.preventDefault();
const formData = new FormData(formEl);
const object = {user: formData.get('user'), email: formData.get('mail')};
fetch('https://api.account.skynet.ie/ldap/recover/ssh/request', {
method: 'POST',
body: JSON.stringify(object),
mode: "cors"
})
.then(status)
.then(json)
.catch(() => {
document.getElementById('formStatus').innerHTML = "<span style='background-color: yellow; color: black'>Please try again</span>";
});
}
function status(res) {
if (res.status === 200) {
return res.json();
} else if (res.status === 500) {
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";
} else {
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Failed to communicate to server</span>";
}
}
function json(temp) {
if (temp) {
if (temp.result === 'error') {
document.getElementById('formStatus').innerHTML = `<span style='background-color: red; color: white'>${temp.error}</span>`;
} else {
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
document.getElementById('sign').hidden = false;
document.getElementById('request').hidden = true;
function json(temp) {
if (temp) {
if (temp.result === 'error') {
document.getElementById('formStatus').innerHTML = `<span style='background-color: red; color: white'>${temp.error}</span>`;
} else {
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
}
}
}
</script>
</main>
<footer class="page-footer">
UL Computer Society 2023-<span id="year">2023</span>
<script>
document.getElementById('year').textContent = new Date().getFullYear().toString()
</script>
</footer>
</div>
</body>
</html>
}
</script>
</main>
<footer class="page-footer">
UL Computer Society 2023-<span id="year">2023</span>
<script>
document.getElementById('year').textContent = new Date().getFullYear().toString()
</script>
</footer>
</div>
</body></html>