Skip to content

Instantly share code, notes, and snippets.

@Octagon-simon
Created October 21, 2022 08:03
Show Gist options
  • Select an option

  • Save Octagon-simon/2b9c34c00244d0436df00d506a2e6a21 to your computer and use it in GitHub Desktop.

Select an option

Save Octagon-simon/2b9c34c00244d0436df00d506a2e6a21 to your computer and use it in GitHub Desktop.

Revisions

  1. Octagon-simon created this gist Oct 21, 2022.
    8 changes: 8 additions & 0 deletions pass-reset-part-2.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    //generate password reset hash
    userSchema.methods.generatePasswordResetHash = function(){
    //create hash object,
    //then create a sha512 hash of the user's hashed password
    //and then return hash
    const resetHash = crypto.createHash('sha512').update(this.hash).digest('hex')
    return resetHash;
    }