diff options
author | Simone <26844016+simonebortolin@users.noreply.github.com> | 2023-08-13 09:37:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-13 09:37:05 +0200 |
commit | 2226f98ba54659a7182b03254224b7bac71f18a2 (patch) | |
tree | c9e698a5b8c72b4e0a0229fd035776308df33129 /_includes/cig_password_xgspon.html | |
parent | Update vendor (Youhua) (#263) (diff) | |
download | hack-gpon.github.io-2226f98ba54659a7182b03254224b7bac71f18a2.tar hack-gpon.github.io-2226f98ba54659a7182b03254224b7bac71f18a2.tar.gz hack-gpon.github.io-2226f98ba54659a7182b03254224b7bac71f18a2.tar.bz2 hack-gpon.github.io-2226f98ba54659a7182b03254224b7bac71f18a2.tar.lz hack-gpon.github.io-2226f98ba54659a7182b03254224b7bac71f18a2.tar.xz hack-gpon.github.io-2226f98ba54659a7182b03254224b7bac71f18a2.tar.zst hack-gpon.github.io-2226f98ba54659a7182b03254224b7bac71f18a2.zip |
Diffstat (limited to '_includes/cig_password_xgspon.html')
-rw-r--r-- | _includes/cig_password_xgspon.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/_includes/cig_password_xgspon.html b/_includes/cig_password_xgspon.html new file mode 100644 index 0000000..5e49d23 --- /dev/null +++ b/_includes/cig_password_xgspon.html @@ -0,0 +1,51 @@ +<div> + <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="[0-9A-Za-z]{4}[0-9A-Fa-f]{8}"> + <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> + {% if include.password_len_modify == true %} + <div class="form-floating mb-3"> + <input readonly type="text" class="form-control" placeholder="Password length" name="password_len" id="password_len" value="{{include.password_len}}"> + <label for="password_len" class="form-label">Password length</label> + </div> + {% else %} + <input readonly type="hidden" name="password_len" id="password_len" value="{{include.password_len}}"> + {% endif %} + <div class="mb-3"> + <input type="submit" class="btn btn-primary" value="Generate!" id="submit"> + <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"> + <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" class="form-label">Password</label> + </div> + </form> + <script> + var cigPassword = document.getElementById('cig-password'); + cigPassword.addEventListener('submit', (event) => { + event.preventDefault(); + if (!cigPassword.checkValidity()) { + event.preventDefault(); + } else { + const data = new URLSearchParams(new FormData(cigPassword)); + var url = new URL("https://cigpassword.hack-gpon.org/xgspon/"); + url.search = data.toString(); + fetch(url, {mode: 'cors'}).then(response => response.json()).then(json => { + document.getElementById('result').value = json.password; + document.getElementById('username').value = json.username; + }).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 |