Code standardisation

Signed-off-by: Eoghan Conlon <eoghanconlon73@skynet.ie>
This commit is contained in:
eoghanconlon73 2023-09-18 12:18:33 +01:00
parent 2e72c1deaf
commit c9e91ba1be
6 changed files with 120 additions and 111 deletions

View file

@ -8,18 +8,19 @@
</head>
<body>
<div id="title">
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145" height="81.56"/> </a>
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145"
height="81.56"/> </a>
<h1>Skynet Password Reset & Sign-up service</h1>
</div>
<div class="boxes">
<h2><a href="./signup.html">Sign-up Page</a></h2>
<p>Please use this if you have yet to activate an account on Skynet before.</p>
<h2><a href="password.html">Password Reset</a></h2>
<p>Please use this service if you ever forget your skynet password</p>
<h2><a href="modify.html">User modification</a></h2>
<p>
Please use this service to modify your user data (email, login ssh key, etc.)
</p>
<h2><a href="password.html">Password Reset</a></h2>
<p>Please use this service if you ever forget your skynet password</p>
<h2><a href="modify.html">User modification</a></h2>
<p>
Please use this service to modify your user data (email, login ssh key, etc.)
</p>
</div>
<!--testing2-->

View file

@ -8,45 +8,46 @@
</head>
<body>
<div id="title">
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145" height="81.56"/> </a>
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145"
height="81.56"/> </a>
<h1>Skynet Password Reset & Sign-up service</h1>
</div>
<div class="boxes">
<h2>User modification page</h2>
<p>Use this page to modify your account. Please remember to select a field before submitting the form</p>
<form id="reset">
<table id="table">
<tr>
<td><label for="user">Username</label></td>
<td><input type="text" id="user" name="user"/> <br/></td>
</tr>
<tr>
<td><label for="pass">Password</label></td>
<td><input type="password" id="pass" name="pass"/> <br/></td>
</tr>
<tr>
<td><label for="field">Field</label> </td>
<td>
<select onchange="selectField()" id="field">
<option value="" selected="selected">Please select an option</option>
<option value="mail">Email</option>
<option value="sshPublicKey">SSH key</option>
<option value="cn">First name & Surname</option>
<option value="sn">Surname</option>
<option value="skDiscord">Discord username</option>
</select>
</td>
</tr>
<tr>
<td><label for="value">Value</label></td>
<td><input type="text" id="value" name="value"/> <br/> </td>
</tr>
<tr>
<td colspan="2"><input type="Submit" value="Submit"/></td>
</tr>
</table>
</form>
<p id="formStatus"></p>
<form id="reset">
<table id="table">
<tr>
<td><label for="user">Username</label></td>
<td><input type="text" id="user" name="user"/> <br/></td>
</tr>
<tr>
<td><label for="pass">Password</label></td>
<td><input type="password" id="pass" name="pass"/> <br/></td>
</tr>
<tr>
<td><label for="field">Field</label></td>
<td>
<select onchange="selectField()" id="field">
<option value="" selected="selected">Please select an option</option>
<option value="mail">Email</option>
<option value="sshPublicKey">SSH key</option>
<option value="cn">First name & Surname</option>
<option value="sn">Surname</option>
<option value="skDiscord">Discord username</option>
</select>
</td>
</tr>
<tr>
<td><label for="value">Value</label></td>
<td><input type="text" id="value" name="value"/> <br/></td>
</tr>
<tr>
<td colspan="2"><input type="Submit" value="Submit"/></td>
</tr>
</table>
</form>
<p id="formStatus"></p>
</div>
<footer>
UL Computer Society 2023-<span id="year">2023</span>
@ -71,7 +72,7 @@
}).then(res => {
if (res.status === 200) {
let temp = res.json();
if(temp.result === 'error'){
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>";
@ -87,10 +88,10 @@
}
}
function selectField(){
function selectField() {
const field = document.getElementById('field').value;
const value = document.getElementById('value');
if(field === 'mail'){
if (field === 'mail') {
value.type = 'email';
} else {
value.type = 'text';

View file

@ -1,43 +1,44 @@
<!DOCTYPE html>
<html lang="en-ie">
<head>
<meta charset="UTF-8" />
<meta charset="UTF-8"/>
<title>Password reset</title>
<link rel="icon" type="image/png" href="images/favicon/favicon-16x16.png" />
<link rel="icon" type="image/png" href="images/favicon/favicon-16x16.png"/>
<link rel="stylesheet" type="text/css" href="stylesheets/index.css"/>
</head>
<body>
<div id="title">
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145" height="81.56"/> </a>
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145"
height="81.56"/> </a>
<h1>Skynet Password Reset & Sign-up service</h1>
</div>
<div class="boxes">
<h2>Password Reset</h2>
<h2>Password Reset</h2>
<p>Please use this page to reset you password should you need to change it.</p>
<form id="reset">
<table id="table">
<tr>
<td><label for="user">Username</label></td>
<td><input type="text" id="user" name="user" /> <br /></td>
</tr>
<tr>
<td><label for="pass">Old Password</label></td>
<td><input type="password" id="pass" name="pass" /> <br /></td>
<form id="reset">
<table id="table">
<tr>
<td><label for="user">Username</label></td>
<td><input type="text" id="user" name="user"/> <br/></td>
</tr>
<tr>
<td><label for="newPW1">New Password</label></td>
<td><input type="password" id="newPW1" name="newPW" /> <br /></td>
<tr>
<td><label for="pass">Old Password</label></td>
<td><input type="password" id="pass" name="pass"/> <br/></td>
</tr>
<tr>
<td><label for="newPW2">Confirm</label></td>
<td><input type="password" id="newPW2" name="newPWConfirm" /> <br /> </td>
</tr>
<tr>
<td colspan="2"><input type="Submit" value="Submit" /></td>
</tr>
</table>
</form>
<p id="formStatus"></p>
<tr>
<td><label for="newPW1">New Password</label></td>
<td><input type="password" id="newPW1" name="newPW"/> <br/></td>
</tr>
<tr>
<td><label for="newPW2">Confirm</label></td>
<td><input type="password" id="newPW2" name="newPWConfirm"/> <br/></td>
</tr>
<tr>
<td colspan="2"><input type="Submit" value="Submit"/></td>
</tr>
</table>
</form>
<p id="formStatus"></p>
</div>
<footer>
UL Computer Society 2023-<span id="year">2023</span>
@ -46,22 +47,22 @@
const formEl = document.getElementById("reset");
formEl.addEventListener('submit', (listener) => formHandler(listener));
function formHandler(listener){
function formHandler(listener) {
listener.preventDefault();
const formData = new FormData(formEl);
const user = formData.get("user");
const pass = formData.get("pass");
const newPW = formData.get("newPW");
if(newPW === formData.get("newPWConfirm")){
if (newPW === formData.get("newPWConfirm")) {
const object = {user: user, pass: pass, field: "userPassword", value: newPW}
fetch('https://api.account.skynet.ie/ldap/update', {
method: 'POST',
body: JSON.stringify(object),
mode: "cors"
}).then(res => {
if(res.status === 200) {
if (res.status === 200) {
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
} else if (res.status === 500){
} 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>";

View file

@ -8,31 +8,33 @@
</head>
<body>
<div id="title">
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145" height="81.56"/> </a>
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145"
height="81.56"/> </a>
<h1>Skynet Password Reset & Sign-up service</h1>
</div>
<div class="boxes">
<h2>Register</h2>
<p>Thank you for signing up for your free skynet account. Please complete the process by filling in the form below</p>
<form id="register">
<table id="table">
<tr>
<td><label for="user">Username</label></td>
<td><input type="text" id="user" name="user"/> <br/> </td>
</tr>
<tr>
<td><label for="pass">Password</label></td>
<td><input type="password" id="pass" name="pass" minlength="8" maxlength="254"/> <br/></td>
</tr>
<tr>
<td><label for="confirm">Confirm</label></td>
<td><input type="password" id="confirm" name="confirm"/> </td>
</tr>
<tr>
<td colspan="2"> <input type="Submit" value="Submit"/> </td>
</tr>
</table>
</form>
<h2>Register</h2>
<p>Thank you for signing up for your free skynet account. Please complete the process by filling in the form
below</p>
<form id="register">
<table id="table">
<tr>
<td><label for="user">Username</label></td>
<td><input type="text" id="user" name="user"/> <br/></td>
</tr>
<tr>
<td><label for="pass">Password</label></td>
<td><input type="password" id="pass" name="pass" minlength="8" maxlength="254"/> <br/></td>
</tr>
<tr>
<td><label for="confirm">Confirm</label></td>
<td><input type="password" id="confirm" name="confirm"/></td>
</tr>
<tr>
<td colspan="2"><input type="Submit" value="Submit"/></td>
</tr>
</table>
</form>
</div>
<p id="formStatus"></p>
<footer>

View file

@ -39,22 +39,25 @@
</head>
<body>
<div id="title">
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145" height="81.56"/> </a>
<a href="./"><img src="images/sharky_vector_svg.svg" alt="Picture of Sharky, the mascot of skynet" width="145"
height="81.56"/> </a>
<h1>Skynet Password Reset & Sign-up service</h1>
</div>
<div class="boxes">
<h2>Welcome to Skynet</h2>
<p>
Skynet is a server cluster that the UL Computer Society runs. If you previously had an account and need to activate <br />
it please click <a href="./modify.html">here</a> to set a contact email address for your account. IF you are a new <br />
user, please fill in the form below with the email that you use on ul wolves.
</p>
<form id="register">
<label for="mail">Email address</label>
<input type="email" id="mail" name="email"/> <br/>
<input type="submit" value="Submit"/>
</form>
<p id="formStatus"></p>
<h2>Welcome to Skynet</h2>
<p>
Skynet is a server cluster that the UL Computer Society runs. If you previously had an account and need to
activate <br/>
it please click <a href="./modify.html">here</a> to set a contact email address for your account. IF you are a
new <br/>
user, please fill in the form below with the email that you use on ul wolves.
</p>
<form id="register">
<label for="mail">Email address</label>
<input type="email" id="mail" name="email"/> <br/>
<input type="submit" value="Submit"/>
</form>
<p id="formStatus"></p>
</div>
<footer>
UL Computer Society 2023-<span id="year">2023</span>

View file

@ -1,8 +1,9 @@
/* General styling */
body{
body {
background-image: url(../images/backgroundsharkycoin.png);
text-align: center;
}
/* Title bar */
#title {
display: inline-flex;
@ -22,6 +23,6 @@ body{
margin-bottom: 3%;
}
#table{
#table {
display: inline;
}