function forgot_password() { $("#form_name").val("forgot_password"); $("#login_form").submit(); } function validate_forgot_password() { if ($("#property_name_or_email").val() == "") { $( "#property_name_or_email").next().html('You must enter the property name or your email address'); return false; } else { $("#form_name").val("forgot_password_entry_form"); return true; } } $( document ).ready(function() { $( "#password_reset_form" ).submit(function( event ) { return validate_password_reset_form(); }); }); function validate_password_reset_form() { valid = true; if (!check_upper_lower_numeral($("#password").val())) { $( "#password").next().html('Password must have upper case, lower case and a numeral'); valid = false; } else if ($("#password").val().length < 8) { $( "#password").next().html('Password must be at least eight characters'); valid = false; } else $( "#password").next().html(''); if ($("#password").val() != $("#repeat_password").val()){ $( "#repeat_password").next().html('Passwords must match'); valid = false; } else $( "#repeat_password").next().html(''); return valid; } function check_upper_lower_numeral(password) { var regex = /(?=.\d)/ if (!regex.test(password)) { //alert('fail numeral'); return false; } var regex = /(?=.[a-z])/ if (!regex.test(password)) { //alert('fail small letter'); return false; } var regex = /(?=.*[A-Z])/ if (!regex.test(password)) { //alert('fail capital letter'); return false; } return true; }