Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Validation Engine and hashing with Sha512
    text
    copied!<p>I have a problem with getting the password hashing working alongside with jQuery validation engine. The problem is that I can't seem to hash the given password.</p> <p>This is what i have so far.</p> <pre><code> &lt;script&gt; jQuery(document).ready( function() { jQuery("#form").validationEngine('attach', {onValidationComplete: function(form, status){ if (status == true) { $("form#form").bind('submit', function(e) { e.preventDefault(); }); function formhash(form, password) { var p = document.createElement("input"); form.appendChild(p); p.name = "p"; p.type = "hidden"; p.value = hex_sha512(password.value); password.value = ""; form.submit(); } } } }) }; &lt;/script&gt; </code></pre> <p>By running the processing script after the submission I can find and use the un-hashed password but that just isn't good enough for me.</p> <p>What am I doing wrong?</p> <p>Edit: I applied some more javascript and an additional "background validation" by isolation the function (formhash) and put in in a seperate file, added onsubmit="return validate(this);" in the form header. It ain't that pretty but it seems to do the trick. </p> <p>Any suggestions about improvments are still welcome though. </p> <pre><code> &lt;script type="text/javascript"&gt; function validate(form) { var reason = ""; reason += validatePassword(form.password); if (reason != "") { return false; } formhash(form, form.password) return true; } function validatePassword(fld) { var error = ""; if (fld.value == "") { error = ""; } return error; } &lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload