Compare commits

...

1 commit

Author SHA1 Message Date
db6c5aa2a3 Getting started on the second part of ssh recovery 2023-11-06 13:46:39 +00:00

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>
<form id="form"> <script>
<table id="table"> const formE2 = document.getElementById("form2");
<tr> formE2.addEventListener('submit', formHandler);
<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);
function formHandler(listener) { function formHandler(listener) {
listener.preventDefault(); listener.preventDefault();
const formData = new FormData(formEl); const formData = new FormData(formE2);
const object = {user: formData.get('user'), email: formData.get('mail')}; const object = {user: formData.get('user'), auth_signed: formData.get('signed')};
fetch('https://api.account.skynet.ie/ldap/recover/ssh/request', { fetch('https://api.account.skynet.ie/ldap/recover/ssh/verify', {
method: 'POST', method: 'POST',
body: JSON.stringify(object), body: JSON.stringify(object),
mode: "cors" mode: "cors"
}) })
.then(status) .then(status)
.then(json) .then(json)
.catch(() => { .catch(() => {
document.getElementById('formStatus').innerHTML = "<span style='background-color: yellow; color: black'>Please try again</span>"; 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) { 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>
<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> </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>