Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I managed to get it working with help from (<em>agx</em>) from the Experts Exchange forum. It turns out it was human error on my part. I had an extra space in my insert query of the registration process and also set the encoding to UTF-8:</p> <blockquote> <p>'(space)#hash(form.password, "sha-384" ,'UTF-8')#'</p> </blockquote> <p>I changed the password type to <code>char(96)</code>, and amended the <code>cfqueryparam</code>, as suggested. Thank you all for your help and guidance. Below is troubleshooting code, I used to help me figure this out:</p> <p><strong>Entered an email and password of an existing entry, to grab record from the db:</strong></p> <pre><code>&lt;cfset form.email = "some known email"&gt; &lt;cfset form.userPassword = "real password before hashing"&gt; &lt;!--- ONLY match on email ----&gt; &lt;cfquery name="qGetData" ....&gt; SELECT * FROM yourTable WHERE email =&lt;cfqueryparam value='#FORM.email#' cfsqltype="cf_sql_varchar"&gt; &lt;/cfquery&gt; &lt;!--- Checking to see if the password is hashed or is in clear text ---&gt; &lt;cfdump var="#qGetData#"&gt; </code></pre> <p><strong>Hashed the clear text password and compared it to the db value.</strong> </p> <pre><code>&lt;cfset newhash = hash(form.userPassword,'SHA-384')&gt; &lt;cfif compare(newHash, qGetData.userPass) eq 0&gt; SAME &lt;cfelse&gt; DIFFERENT &lt;/cfif&gt; </code></pre> <p><strong>At first sight the values looked the same. To make sure both the stored password in db and password from the login form were the same, the following code was used:</strong></p> <pre><code>&lt;cfoutput&gt; db |#qGetData.userPass#|&lt;br&gt; form |#hash(form.userPassword,'SHA-384')#|&lt;br&gt; &lt;/cfoutput&gt; </code></pre> <p>I then used a <a href="http://www.diffnow.com/" rel="nofollow">handy website to compare the outputs</a>. The results were the same again. After all this hard work, it turned there was an extra space in front of the <code>#hash(...)#</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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