Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Advanced Node and Express - Hashing Your Passwords - needs refactoring #119

Closed
ivan3123708 opened this issue Jul 9, 2018 · 1 comment · Fixed by #125
Closed

Advanced Node and Express - Hashing Your Passwords - needs refactoring #119

ivan3123708 opened this issue Jul 9, 2018 · 1 comment · Fixed by #125

Comments

@ivan3123708
Copy link
Contributor

Describe the bug

https://learn.freecodecamp.org/information-security-and-quality-assurance/advanced-node-and-express/hashing-your-passwords

Challenge suggest the following code to hash a password:

var hash = bcrypt.hash(req.body.password, 12);

... and than saving the hash variable to the database, but this code returns a promise and therefore cannot be saved as password. So we need to handle the promise and then save the response as password, or the second solution would be to change the code and use hashSync method.

To Reproduce

Steps to reproduce the behavior:

var bcrypt = require('bcrypt');

var hash = bcrypt.hash('some_password', 12);

console.log(hash) // returns a Promise instead of a hash

Expected behavior

The code should return a hashed password

Desktop (please complete the following information):

  • OS: Ubuntu 18.04 LTS
  • Browser: Google Chrome
  • Version: 67.0.3396.87 (Official Build) (64-bit)

Additional context

I can work on this and will make a PR if you agree this challenge needs to refactor...

raisedadead pushed a commit that referenced this issue Jul 27, 2018
# [3.1.0](v3.0.1...v3.1.0) (2018-07-27)

### Bug Fixes

* **challenge:** syntax error in sample code snippet ([1d3e076](1d3e076))
* **challenge:** typos in first Basic CSS challenge test ([5e41e74](5e41e74))
* **challenges:** add code input space for final d3 challenge ([f0b7ea9](f0b7ea9))
* **challenges:** add comments to getter/setter instructions codeblock ([9e9bc27](9e9bc27)), closes [#92](#92)
* **challenges:** add solution project euler 52 ([f31fe38](f31fe38))
* **challenges:** add solution to project euler 53 ([56d7caf](56d7caf))
* **challenges:** add user story to tribute page challange ([12c78d4](12c78d4))
* **challenges:** allows single quotes ([57dab6d](57dab6d))
* **challenges:** broken link ([64b93df](64b93df))
* **challenges:** broken link ([de30ac8](de30ac8)), closes [#17823](https://github.com/freeCodeCamp/curriculum/issues/17823)
* **challenges:** change del tag to s tag ([4dc7589](4dc7589))
* **challenges:** change green-box class margin to match red-box ([9fd5533](9fd5533)), closes [#169](#169)
* **challenges:** change innerHTML to textContent ([#160](#160)) ([06e1ba1](06e1ba1)), closes [freeCodeCamp/freeCodeCamp#17888](freeCodeCamp/freeCodeCamp#17888)
* **challenges:** fix 2nd test bug ([362fc8a](362fc8a)), closes [#17769](https://github.com/freeCodeCamp/curriculum/issues/17769) [#17039](https://github.com/freeCodeCamp/curriculum/issues/17039) [#16967](https://github.com/freeCodeCamp/curriculum/issues/16967)
* **challenges:** fix broken tests - es6_declarative_function ([667dba9](667dba9))
* **challenges:** fix challenge for fallback value of CSS variable ([3abf7ad](3abf7ad))
* **challenges:** fix description and tests to use sync hashing ([cfa99ef](cfa99ef)), closes [#119](#119)
* **challenges:** fix initial contents ([9329543](9329543))
* **challenges:** fix regex (es6 : import vs require) ([f4d598f](f4d598f)), closes [#108](#108)
* **challenges:** fix regex in applied visual design challenge ([#162](#162)) ([5a34767](5a34767)), closes [#161](#161) [#161](#161)
* **challenges:** fix regex to allow redundant space characters ([8b99b8b](8b99b8b))
* **challenges:** fix typo in "split string into array using split" ([5b27dfd](5b27dfd))
* **challenges:** fix typo in a "mongodb and mongoose" challenge ([bd67a66](bd67a66))
* **challenges:** fix typo in a node and express challenge ([78d86a4](78d86a4))
* **challenges:** fix typo in findOneAndUpdate() challenge ([ab912e4](ab912e4))
* **challenges:** fix typo in node and express challenge ([7f3ed42](7f3ed42))
* **challenges:** fix typos ([82f85b0](82f85b0))
* **challenges:** fixed a typo in Data structures challege ([a4f810e](a4f810e)), closes [freeCodeCamp/freeCodeCamp#17786](freeCodeCamp/freeCodeCamp#17786)
* **challenges:** fixed RegEx for template literals javascript challenge ([66d8463](66d8463)), closes [#65](#65)
* **challenges:** fixed regex in a challenge ([c28aac0](c28aac0)), closes [freeCodeCamp/freeCodeCamp#17861](freeCodeCamp/freeCodeCamp#17861)
* **challenges:** glitch links in backend projects now open in new tabs ([507c22d](507c22d)), closes [#17799](https://github.com/freeCodeCamp/curriculum/issues/17799)
* **challenges:** grammatical error ([5308332](5308332))
* **challenges:** improve template literal challenge instructions ([99f4b9f](99f4b9f))
* **challenges:** inline style semicolon consistency ([3557016](3557016)), closes [#17909](https://github.com/freeCodeCamp/curriculum/issues/17909)
* **challenges:** minor css grid typo ([f147430](f147430))
* **challenges:** moved the <em> tag inside the <p> tag ([128794d](128794d))
* **challenges:** remove obsolete mention of beta and update link [#144](#144) ([59d98b8](59d98b8))
* **challenges:** replace assertions in authentication with socket.io ([20e3617](20e3617)), closes [#82](#82)
* **challenges:** typo and grammatical error ([c1160c5](c1160c5))
* **challenges:** typo error ([2d3ca6d](2d3ca6d))
* **challenges:** typo in javascript algorithms/debugging/2 ([8286ff9](8286ff9))
* **challenges:** typos in some basic node and express challenges ([93277e5](93277e5)), closes [#113](#113) [#114](#114)
* clarify unclear instructions ([2a7a3fa](2a7a3fa))
* incomplete Sass Test ([086a4a0](086a4a0))
* penguin colors to match directions ([0f4b8a9](0f4b8a9))
* **challenges:** update pseudo-element selector syntax from CSS2 to CSS3 ([15675e8](15675e8))
* **challenges:** update RegEx for testcase in es6 challenge ([857b3e9](857b3e9))
* **challenges:** update test suite CDN link ([a311e06](a311e06))
* **challenges:** updated dates ([21bb9d0](21bb9d0)), closes [#17908](https://github.com/freeCodeCamp/curriculum/issues/17908)
* **gitignore file:** added .vscode and unpacked folder to the file ([1b8eb67](1b8eb67))

### Features

* **challenge:** add tests for the timestamp microservice challenge ([0cb0da8](0cb0da8))
@raisedadead
Copy link
Member

🎉 This issue has been resolved in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants