i think checking the second input is useless and has no logical reason, i mean in both cases you end up with empty #pass2
$("form").on('submit',function(){
if($("#pass1").val() == ''){
$("#pass2").val('');
return false;
}
});