abstracted out the validation js, need to add it to signup, then basically write up broken auth for both lack of pwd complexity and username/password enumeration
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
function validation(){
|
||||
$("#account_edit").validate({
|
||||
rules: {
|
||||
"user[password]": {
|
||||
required: false,
|
||||
minlength: 5
|
||||
},
|
||||
"user[password_confirmation]": {
|
||||
required: false,
|
||||
minlength: 5,
|
||||
equalTo: "#user_password"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
"user[password]": {
|
||||
minlength: "Your password must be at least 6 characters long"
|
||||
},
|
||||
"user[password_confirmation]": {
|
||||
minlength: "Your password must be at least 6 characters long",
|
||||
equalTo: "Please enter the same password as above"
|
||||
}
|
||||
},
|
||||
highlight: function(label) {
|
||||
$("#submit_button").attr('disabled','disabled');
|
||||
$(label).closest('.control-group').addClass('error');
|
||||
},
|
||||
success: function(label) {
|
||||
label.closest('.control-group').addClass('success');
|
||||
$("#submit_button").removeAttr('disabled');
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(validation());
|
||||
@@ -56,42 +56,9 @@
|
||||
<% end %>
|
||||
<!-- End Modal -->
|
||||
|
||||
<script type="text/javascript">
|
||||
<%= javascript_include_tag ('validation.js')%>
|
||||
|
||||
function validation(){
|
||||
$("#account_edit").validate({
|
||||
rules: {
|
||||
"user[password]": {
|
||||
required: false,
|
||||
minlength: 5
|
||||
},
|
||||
"user[password_confirmation]": {
|
||||
required: false,
|
||||
minlength: 5,
|
||||
equalTo: "#user_password"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
"user[password]": {
|
||||
minlength: "Your password must be at least 6 characters long"
|
||||
},
|
||||
"user[password_confirmation]": {
|
||||
minlength: "Your password must be at least 6 characters long",
|
||||
equalTo: "Please enter the same password as above"
|
||||
}
|
||||
},
|
||||
highlight: function(label) {
|
||||
$("#submit_button").attr('disabled','disabled');
|
||||
$(label).closest('.control-group').addClass('error');
|
||||
},
|
||||
success: function(label) {
|
||||
label.closest('.control-group').addClass('success');
|
||||
$("#submit_button").removeAttr('disabled');
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$('#submit_button').click(function() {
|
||||
var valuesToSubmit = $("#account_edit").serialize();
|
||||
@@ -129,6 +96,4 @@ $('#delete_button').click(function() {
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(validation());
|
||||
|
||||
</script>
|
||||
|
||||
@@ -51,47 +51,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function validation(){
|
||||
$("#account_edit").validate({
|
||||
rules: {
|
||||
"user[password]": {
|
||||
required: false,
|
||||
minlength: 5
|
||||
},
|
||||
"user[password_confirmation]": {
|
||||
required: false,
|
||||
minlength: 5,
|
||||
equalTo: "#user_password"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
"user[password]": {
|
||||
minlength: "Your password must be at least 6 characters long"
|
||||
},
|
||||
"user[password_confirmation]": {
|
||||
minlength: "Your password must be at least 6 characters long",
|
||||
equalTo: "Please enter the same password as above"
|
||||
}
|
||||
},
|
||||
highlight: function(label) {
|
||||
$("#submit_button").attr('disabled','disabled');
|
||||
$(label).closest('.control-group').addClass('error');
|
||||
},
|
||||
success: function(label) {
|
||||
label.closest('.control-group').addClass('success');
|
||||
$("#submit_button").removeAttr('disabled');
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$(document).ready(validation());
|
||||
|
||||
</script>
|
||||
|
||||
<%= javascript_include_tag ('validation.js')%>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user