summaryrefslogtreecommitdiffstats
path: root/_includes
diff options
context:
space:
mode:
authorSimone <26844016+simonebortolin@users.noreply.github.com>2022-12-30 17:54:00 +0100
committerGitHub <noreply@github.com>2022-12-30 17:54:00 +0100
commit9b16504485a14b477aa00ae33a43d91e7e4ce9e6 (patch)
tree5e1d9aba2b5e70055ed96daba87786d80cc6085e /_includes
parentHot fix pages.yml (#74) (diff)
downloadhack-gpon.github.io-9b16504485a14b477aa00ae33a43d91e7e4ce9e6.tar
hack-gpon.github.io-9b16504485a14b477aa00ae33a43d91e7e4ce9e6.tar.gz
hack-gpon.github.io-9b16504485a14b477aa00ae33a43d91e7e4ce9e6.tar.bz2
hack-gpon.github.io-9b16504485a14b477aa00ae33a43d91e7e4ce9e6.tar.lz
hack-gpon.github.io-9b16504485a14b477aa00ae33a43d91e7e4ce9e6.tar.xz
hack-gpon.github.io-9b16504485a14b477aa00ae33a43d91e7e4ce9e6.tar.zst
hack-gpon.github.io-9b16504485a14b477aa00ae33a43d91e7e4ce9e6.zip
Diffstat (limited to '_includes')
-rw-r--r--_includes/cig_password.html30
-rw-r--r--_includes/icons/custom.html9
2 files changed, 27 insertions, 12 deletions
diff --git a/_includes/cig_password.html b/_includes/cig_password.html
index 5118a5c..e3be28b 100644
--- a/_includes/cig_password.html
+++ b/_includes/cig_password.html
@@ -1,32 +1,40 @@
<div>
- <form id="cig-password">
+ <form id="cig-password" novalidate>
<div class="form-floating mb-3">
<input type="text" class="form-control" placeholder="Serial Number" name="serial" id="serial" required pattern="[A-Z]{4}[0-9a-z]{8}">
- <label for="serial">GPON S/N in format GPONabc12345</label>
+ <label for="serial" class="form-label">GPON S/N in format GPONabc12345</label>
+ <div class="invalid-feedback">
+ Please provide a valid GPON S/N.
+ </div>
</div>
<div class="mb-3">
<input type="submit" class="btn btn-primary" value="Generate!" id="submit">
- <label for="submit">Warning: this script is hosted on a third-party server.</label>
+ <label for="submit" class="form-label">Warning: this script is hosted on a third-party server.</label>
</div>
<div class="form-floating mb-3">
<input readonly type="text" class="form-control" placeholder="Serial Number" name="username" id="username" value="{{include.username}}">
- <label for="username">Username</label>
+ <label for="username" class="form-label">Username</label>
</div>
<div class="form-floating mb-3">
<input readonly class="form-control" type="text" id="result" placeholder="Result">
- <label for="result">Password</label>
+ <label for="result" class="form-label">Password</label>
</div>
</form>
<script>
var cigPassword = document.getElementById('cig-password');
cigPassword.addEventListener('submit', (event) => {
event.preventDefault();
- const data = new URLSearchParams(new FormData(cigPassword));
- var url = new URL("https://cigpassword.ml/");
- url.search = data.toString();
- fetch(url, {mode: 'cors'}).then(response => response.json()).then(json => document.getElementById('result').value = json.password).catch((error) => {
- document.getElementById('result').value = "Error!"
- });
+ if (!cigPassword.checkValidity()) {
+ event.preventDefault();
+ } else {
+ const data = new URLSearchParams(new FormData(cigPassword));
+ var url = new URL("https://cigpassword.ml/");
+ url.search = data.toString();
+ fetch(url, {mode: 'cors'}).then(response => response.json()).then(json => document.getElementById('result').value = json.password).catch((error) => {
+ document.getElementById('result').value = "Error!"
+ });
+ }
+ [...cigPassword.elements].map(e => e.parentNode).forEach(e => e.classList.toggle('was-validated', true));
});
</script>
</div> \ No newline at end of file
diff --git a/_includes/icons/custom.html b/_includes/icons/custom.html
index a83ef5b..7fc2266 100644
--- a/_includes/icons/custom.html
+++ b/_includes/icons/custom.html
@@ -9,4 +9,11 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="GitHub">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>
</svg>
-</symbol> \ No newline at end of file
+</symbol>
+<symbol id="svg-edit" viewBox="0 0 24 24">
+ <title>Edit</title>
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
+ <path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z">
+ </path>
+ </svg>
+</symbol> \ No newline at end of file