47 lines
2.0 KiB
Plaintext
47 lines
2.0 KiB
Plaintext
<%- include('logintop') %>
|
|
|
|
<section class="wrapper">
|
|
<div class="form">
|
|
<header>Reset Password</header>
|
|
<div class="card-header shadow actionMessage" style="display:none"></div>
|
|
<!-- <form action="auth/resetpassword/<%= token.token%>" method="post" onsubmit="formAJAX(this)"> -->
|
|
<form action="auth/resetpassword/<%= token%>" method="post" onsubmit="formAJAX(this)" evalAJAX="app.auth.logInRedirect();">
|
|
<input type="password" id="password" name="password" placeholder="Password" required />
|
|
<input type="password" id="confirmPassword" name="confirmPassword" placeholder="Confirm Password"
|
|
required />
|
|
<input type="submit" value="Reset Password" />
|
|
</form>
|
|
<br>
|
|
<a>Dont have an account?</a> <a href="/login">Sign Up</a>
|
|
</div>
|
|
</section>
|
|
|
|
|
|
<script>
|
|
//both password fields must match
|
|
var password = document.getElementById("password");
|
|
var confirm_password = document.getElementById("confirmPassword");
|
|
|
|
function validatePassword() {
|
|
var passwordValue = password.value;
|
|
|
|
// Strong password regex pattern
|
|
var strongPasswordPattern = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/;
|
|
|
|
if (passwordValue != confirm_password.value) {
|
|
confirm_password.setCustomValidity("Passwords Don't Match");
|
|
} else if (!strongPasswordPattern.test(passwordValue)) {
|
|
confirm_password.setCustomValidity("Password must be at least 8 characters long and include at least one letter, one number, and one special character.");
|
|
} else {
|
|
confirm_password.setCustomValidity('');
|
|
}
|
|
}
|
|
|
|
password.onchange = validatePassword;
|
|
confirm_password.onkeyup = validatePassword;
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|
|
|