2023-08-27 19:59:55 +01:00
<!DOCTYPE html>
< html lang = "en" >
2023-09-27 01:58:27 +01:00
< head >
< meta charset = "UTF-8" / >
< title > Account Recovery< / title >
2023-09-27 02:24:15 +01:00
< link href = "../images/favicon/favicon-16x16.png" rel = "icon" type = "image/png" / >
< link href = "../stylesheets/index.css" rel = "stylesheet" type = "text/css" / >
2023-09-27 01:58:27 +01:00
< / head >
< body >
< div class = "wrapper" >
< header class = "page-header" >
2023-09-27 02:24:15 +01:00
< img alt = "Sharky, our mascot" height = "81.56" src = "../images/sharky.svg" width = "145" / >
< h1 > Skynet Self Service< / h1 >
2023-09-27 01:58:27 +01:00
< / header >
< main class = "page-body" >
< h1 > SSH key recovery< / h1 >
2023-11-06 13:11:17 +00:00
< 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 >
2023-09-27 01:58:27 +01:00
< form id = "form" >
2023-11-06 13:11:17 +00:00
< 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 >
2023-09-27 01:58:27 +01:00
< / form >
< p id = "formStatus" > < / p >
< script >
const formEl = document.getElementById("form");
formEl.addEventListener('submit', formHandler);
2023-08-27 21:14:23 +01:00
2023-09-27 01:58:27 +01:00
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 > ";
});
}
2023-08-27 21:36:30 +01:00
2023-09-27 01:58:27 +01:00
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 > ";
}
}
2023-08-27 21:36:30 +01:00
2023-09-27 01:58:27 +01:00
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 >
2023-08-27 19:59:55 +01:00
< / html >