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,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';