Check if passwords match with js
This commit is contained in:
parent
2c55fbc431
commit
6b730d5b33
@ -7,8 +7,18 @@
|
||||
{{template "head"}}
|
||||
|
||||
<script>
|
||||
function checkPasswordMatch() {
|
||||
var password = $("#password").val();
|
||||
var confirmPassword = $("#password_confirm").val();
|
||||
|
||||
if (password != confirmPassword)
|
||||
$("#divCheckPasswordMatch").html("Passwords do not match!");
|
||||
else
|
||||
$("#divCheckPasswordMatch").html("Passwords match.");
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#invalidCredentials').hide();
|
||||
$("#password, #password_confirm").keyup(checkPasswordMatch);
|
||||
$('#loginForm').ajaxForm({
|
||||
success: function() {
|
||||
window.location.href = "/api/v1/restricted";
|
||||
@ -33,13 +43,12 @@
|
||||
<input type="text" name="name" /><br />
|
||||
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" /><br />
|
||||
<input type="password" name="password" id="password" /><br />
|
||||
|
||||
<label for="password">Verify Password</label>
|
||||
<input type="password" /><br />
|
||||
<input type="password" id="password_confirm" /><br />
|
||||
|
||||
<div id="invalidCredentials">
|
||||
The entered credentials are invalid
|
||||
<div id="divCheckPasswordMatch">
|
||||
</div>
|
||||
|
||||
<input type="submit" value="Login" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user