Update reset-password.html

This commit is contained in:
Alessandro Ferro 2024-03-26 23:27:52 +01:00
parent cc4f6f6a1d
commit 0477e1e60d
1 changed files with 31 additions and 4 deletions

View File

@ -54,10 +54,9 @@
<script> <script>
window.addEventListener("load", function () { window.addEventListener("load", function () {
const secret = new URLSearchParams(window.location.search).get('secret'); const secret = new URLSearchParams(window.location.search).get('secret');
if(!secret){ if (!secret) {
alert('Invalid URL'); alert('Invalid URL');
} } else {
else{
document.body.style.display = "block"; // Show page document.body.style.display = "block"; // Show page
} }
}); });
@ -80,16 +79,44 @@
if (response.ok) { if (response.ok) {
showSuccessAlert('Your password has been changed. You can now <a href="/login.html">log in</a>'); showSuccessAlert('Your password has been changed. You can now <a href="/login.html">log in</a>');
} else { } else {
showErrorAlert('URL either not valid or the link has expired. Please require another <a href="forgot-password.html">password reset</a>'); showErrorAlert(
'URL either not valid or the link has expired. Please require another <a href="forgot-password.html">password reset</a>'
);
} }
} }
function passwordLosesFocus() { function passwordLosesFocus() {
const passwordField = document.getElementById("password");
if(!passwordField.value){
passwordField.classList.add("is-invalid");
document.getElementById('password-invalid-feedback').innerHTML = 'Please fill out this field';
}
else if(passwordField.value.length < 5){
passwordField.classList.add("is-invalid");
document.getElementById('password-invalid-feedback').innerHTML =
'Password must be at least 5 characters';
}
else{
passwordField.classList.remove("is-invalid");
}
} }
function confirmPasswordLosesFocus() { function confirmPasswordLosesFocus() {
const confirmPasswordField = document.getElementById("confirmPassword");
if(!passwordField.value){
confirmPasswordField.classList.add("is-invalid");
document.getElementById('confirmpassword-invalid-feedback').innerHTML = 'Please fill out this field';
}
else if(passwordField.value.length < 5){
confirmPasswordField.classList.add("is-invalid");
document.getElementById('confirmpassword-invalid-feedback').innerHTML =
'Password must be at least 5 characters';
}
else{
confirmPasswordField.classList.remove("is-invalid");
}
} }
function validateFields() { function validateFields() {