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