Check the password equality on javascript.

merge-requests/1/head
meskio 5 years ago
parent ea7a9a096d
commit d4a32b737c
  1. 18
      tmpl/password.html

@ -15,7 +15,7 @@
<div class="form-group">
<label for="oldpass">Antigua contraseña:</label>
<input type="password" class="form-control {{if eq . "WrongOldpass"}}is-invalid{{end}}" id="oldpass" name="oldpass" placeholder="Contraseña">
<div class="invalid-feedback">Contraseña incorrecta.</div>
{{if eq . "WrongOldpass"}}<div class="invalid-feedback">Contraseña incorrecta.</div>{{end}}
</div>
<div class="form-group">
<label for="password">Nueva contraseña:</label>
@ -31,4 +31,20 @@
</div>
</div>
<script>
(function() {
"use strict";
window.addEventListener("load", function() {
var form = document.getElementById("needs-validation");
form.addEventListener("submit", function(event) {
if (form.password.value !== form.password2.value) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add("was-validated");
}, false);
}, false);
}());
</script>
{{template "footer.html"}}

Loading…
Cancel
Save