Spaces:
Runtime error
Runtime error
File size: 1,679 Bytes
b75f547 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
{% extends 'layout.html' %}
{% block title %} Change Password {% endblock %}
{% block content %}
<br><br><br>
<div class="verify-pass">
<form action="/change" method="POST" id="pass-form">
<label for="password">New Password:</label>
<input type="password" class="form-control" id="password" name="password" required><br><br>
<label for="repeat-password">Repeat New Password:</label>
<input type="password" class="form-control" id="repeat-password" required><br><br>
<div id="pass-error-group" class="form-group" style="display:none; text-align:center; text-weight:bold;">
<b><span id="pass-error" style="color:red;"></span></b>
</div>
<center><button type="submit" class="btn btn-primary verify">Change Password!</button></center>
</form>
</div>
<script>
function myFunction() {
var pass = document.getElementById("password").value;
var rep_pass = document.getElementById("repeat-password").value;
let value = pass.localeCompare(rep_pass);
if (value != 0) {
document.getElementById("pass-error-group").style.display = "block";
document.getElementById("pass-error").innerHTML = "! Password does not Match.";
return false;
}
return true;
}
document.getElementById("pass-form").addEventListener("submit", function(event) {
if (!myFunction()) {
event.preventDefault(); // prevent the form from submitting
}
});
</script>
{% endblock %} |